Skip to content

Commit

Permalink
Merge branch 'memory2' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
mnater committed Apr 4, 2019
2 parents 54bc073 + 0228c96 commit 8a785ba
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions Hyphenopoly.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

(function mainWrapper(w) {
"use strict";
const H = Hyphenopoly;
const SOFTHYPHEN = String.fromCharCode(173);

/**
Expand Down Expand Up @@ -66,7 +65,22 @@
/* eslint-enable no-bitwise, sort-keys */
}

(function configurationFactory() {
/**
* Register copy event on element
* @param {Object} el The element
* @returns {undefined}
*/
function registerOnCopy(el) {
el.addEventListener("copy", function oncopy(e) {
e.preventDefault();
const selectedText = window.getSelection().toString();
/* eslint-disable security/detect-non-literal-regexp */
e.clipboardData.setData("text/plain", selectedText.replace(new RegExp(SOFTHYPHEN, "g"), ""));
/* eslint-enable security/detect-non-literal-regexp */
}, true);
}

(function configurationFactory(H) {
const generalDefaults = Object.create(null, {
"defaultLanguage": setProp("en-us", 2),
"dontHyphenate": setProp((function createList() {
Expand Down Expand Up @@ -149,9 +163,9 @@
}
});
H.c = settings;
}());
}(Hyphenopoly));

(function H9Y() {
(function H9Y(H) {
const C = H.c;
let mainLanguage = null;
let elements = null;
Expand Down Expand Up @@ -225,21 +239,6 @@
};
}

/**
* Register copy event on element
* @param {Object} el The element
* @returns {undefined}
*/
function registerOnCopy(el) {
el.addEventListener("copy", function oncopy(e) {
e.preventDefault();
const selectedText = window.getSelection().toString();
/* eslint-disable security/detect-non-literal-regexp */
e.clipboardData.setData("text/plain", selectedText.replace(new RegExp(SOFTHYPHEN, "g"), ""));
/* eslint-enable security/detect-non-literal-regexp */
}, true);
}

/**
* Get language of element by searching its parents or fallback
* @param {Object} el The element
Expand Down Expand Up @@ -1157,5 +1156,5 @@
H.events.dispatch(deferredeo.name, deferredeo.data);
});
delete H.events.deferred;
}());
}(Hyphenopoly));
}(window));

0 comments on commit 8a785ba

Please sign in to comment.