Skip to content

Commit

Permalink
IBX-2255: Added mark text by double click (#317)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasOsti authored Feb 7, 2022
1 parent 1dff836 commit 8f56d37
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/bundle/Resources/encore/ibexa.js.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const layout = [
path.resolve(__dirname, '../public/js/scripts/admin.table.js'),
path.resolve(__dirname, '../public/js/scripts/core/collapse.js'),
path.resolve(__dirname, '../public/js/scripts/admin.dropdown.js'),
path.resolve(__dirname, '../public/js/scripts/double.click.mark.js'),
];
const fieldTypes = [];

Expand Down
15 changes: 15 additions & 0 deletions src/bundle/Resources/public/js/scripts/double.click.mark.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
(function(global, doc) {
const dblClickMarkNodes = doc.querySelectorAll('.ibexa-dbl-click-mark');
const markText = (event) => {
const targetNode = event.currentTarget;
const range = doc.createRange();

range.selectNode(targetNode);
global.getSelection().removeAllRanges();
global.getSelection().addRange(range);
};

dblClickMarkNodes.forEach((dblClickMarkNode) => {
dblClickMarkNode.addEventListener('dblclick', markText, false);
});
})(window, document);

0 comments on commit 8f56d37

Please sign in to comment.