lilium-text
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -44,6 +44,17 @@ "use strict"; | ||
el.addEventListener('click', function (ev) { | ||
el.addEventListener('mousedown', function (ev) { | ||
ev.preventDefault(); | ||
ev.stopPropagation(); | ||
return false; | ||
}); | ||
el.addEventListener('mouseup', function (ev) { | ||
ev.preventDefault(); | ||
ev.stopPropagation(); | ||
editor.log('Executed command ' + _this.webName + (_this.param ? " with parameter '" + _this.param + "'" : '')); | ||
editor.fire('command', _this.webName); | ||
_this.execute(ev, _this, editor); | ||
return false; | ||
}); | ||
@@ -75,2 +86,15 @@ | ||
_createClass(LiliumTextWebCommand, [{ | ||
key: "highlightNode", | ||
value: function highlightNode(node) { | ||
var selection = this.editor.restoreSelection(); | ||
var range = document.createRange(); | ||
this.editor.log("Highlighting node " + node.nodeName + " from Web Command"); | ||
range.selectNode(node); | ||
selection.removeAllRanges(); | ||
selection.addRange(range); | ||
this.editor.storeRange(range); | ||
} | ||
}, { | ||
key: "executeText", | ||
@@ -144,2 +168,4 @@ value: function executeText() { | ||
selection.getRangeAt(0).insertNode(newElem); | ||
this.highlightNode(newElem); | ||
} else if (!leftExistWrap != !rightExistWrap) { | ||
@@ -898,11 +924,15 @@ // Apparently there is no XOR in Javascript, so here's a syntax monstrosity | ||
key: "storeRange", | ||
value: function storeRange() { | ||
var tempSelection = window.getSelection(); | ||
value: function storeRange(maybeRange) { | ||
if (maybeRange) { | ||
this._tempRange = maybeRange; | ||
} else { | ||
var tempSelection = window.getSelection(); | ||
if (tempSelection.type == "None" || !tempSelection.focusNode) { | ||
var range = document.createRange(); | ||
range.setStart(this.contentel, 0); | ||
this._tempRange = range; | ||
} else { | ||
this._tempRange = tempSelection.getRangeAt(0).cloneRange(); | ||
if (tempSelection.type == "None" || !tempSelection.focusNode) { | ||
var range = document.createRange(); | ||
range.setStart(this.contentel, 0); | ||
this._tempRange = range; | ||
} else { | ||
this._tempRange = tempSelection.getRangeAt(0).cloneRange(); | ||
} | ||
} | ||
@@ -909,0 +939,0 @@ |
{ | ||
"name": "lilium-text", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "Web rich text editor. Ready to be used in a test environment.", | ||
@@ -5,0 +5,0 @@ "main": "build/liliumtext.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1384477
2046