lilium-text
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -128,2 +128,3 @@ "use strict"; | ||
/* | ||
if (frag.childNodes[0].nodeName == "#text" && !frag.childNodes[0].data.trim()) { | ||
@@ -133,2 +134,3 @@ this.editor.log("Removed extra empty text node from fragment"); | ||
} | ||
*/ | ||
@@ -161,11 +163,17 @@ var fragWrap = !leftExistWrap && !rightExistWrap && frag.querySelector(nodetype); | ||
while (fragWrap) { | ||
var newFrag = document.createDocumentFragment(); | ||
while (fragWrap.firstChild) { | ||
newFrag.appendChild(fragWrap.firstChild); | ||
if (fragWrap.parentNode) { | ||
while (fragWrap.firstChild) { | ||
fragWrap.parentNode.insertBefore(fragWrap.firstChild, fragWrap); | ||
} | ||
} else { | ||
var newFrag = document.createDocumentFragment(); | ||
while (fragWrap.firstChild) { | ||
newFrag.appendChild(fragWrap.firstChild); | ||
} | ||
var target = fragWrap.Node || frag; | ||
target.insertBefore(newFrag, target.firstChild); | ||
} | ||
var target = fragWrap.parentElement || frag; | ||
target.insertBefore(newFrag, target.firstChild); | ||
fragWrap.remove(); | ||
fragWrap = frag.querySelector(nodetype); | ||
@@ -184,3 +192,3 @@ } | ||
var clone = leftEl.cloneNode(true); | ||
leftEl.parentElement.insertBefore(clone, leftEl); | ||
leftEl.parentNode.insertBefore(clone, leftEl); | ||
@@ -196,3 +204,3 @@ var clonePlaceholder = clone.querySelector('liliumtext-placeholder'); | ||
leftEl.parentElement.insertBefore(frag, leftEl); | ||
leftEl.parentNode.insertBefore(frag, leftEl); | ||
placeholder.remove(); | ||
@@ -278,4 +286,7 @@ clonePlaceholder.remove(); | ||
value: function executeRemove() { | ||
if (this.param) { | ||
var el = this.editor.restoreSelection().focusNode.parentElement; | ||
if (this.param == "a") { | ||
this.editor.restoreSelection(); | ||
document.execCommand('unlink', false); | ||
} else if (this.param) { | ||
var el = this.editor.restoreSelection().focusNode.parentNode; | ||
var context = this.editor.createSelectionContext(el); | ||
@@ -697,3 +708,3 @@ | ||
value: function unwrap(el) { | ||
var par = el.parentElement; | ||
var par = el.parentNode; | ||
while (el.firstChild) { | ||
@@ -794,6 +805,6 @@ par.insertBefore(el.firstChild, el); | ||
} else { | ||
if (ctxElem && ctxElem.nextElementSibling) { | ||
if (ctxElem && ctxElem.nextSibling) { | ||
var curParag = ctxElem; | ||
if (curParag) { | ||
curParag.parentElement.insertBefore(element, curParag.nextElementSibling); | ||
curParag.parentNode.insertBefore(element, curParag.nextSibling); | ||
} | ||
@@ -800,0 +811,0 @@ } else { |
@@ -76,2 +76,3 @@ class LiliumTextCommand { | ||
/* | ||
if (frag.childNodes[0].nodeName == "#text" && !frag.childNodes[0].data.trim()) { | ||
@@ -81,2 +82,3 @@ this.editor.log("Removed extra empty text node from fragment"); | ||
} | ||
*/ | ||
@@ -109,11 +111,17 @@ let fragWrap = !leftExistWrap && !rightExistWrap && frag.querySelector(nodetype); | ||
while (fragWrap) { | ||
const newFrag = document.createDocumentFragment(); | ||
while (fragWrap.firstChild) { | ||
newFrag.appendChild(fragWrap.firstChild); | ||
} | ||
const target = fragWrap.parentElement || frag; | ||
target.insertBefore(newFrag, target.firstChild); | ||
if (fragWrap.parentNode) { | ||
while (fragWrap.firstChild) { | ||
fragWrap.parentNode.insertBefore(fragWrap.firstChild, fragWrap); | ||
} | ||
} else { | ||
const newFrag = document.createDocumentFragment(); | ||
while (fragWrap.firstChild) { | ||
newFrag.appendChild(fragWrap.firstChild); | ||
} | ||
const target = fragWrap.Node || frag; | ||
target.insertBefore(newFrag, target.firstChild); | ||
} | ||
fragWrap.remove(); | ||
fragWrap = frag.querySelector(nodetype); | ||
@@ -132,3 +140,3 @@ } | ||
const clone = leftEl.cloneNode(true); | ||
leftEl.parentElement.insertBefore(clone, leftEl); | ||
leftEl.parentNode.insertBefore(clone, leftEl); | ||
@@ -144,3 +152,3 @@ const clonePlaceholder = clone.querySelector('liliumtext-placeholder'); | ||
leftEl.parentElement.insertBefore(frag, leftEl); | ||
leftEl.parentNode.insertBefore(frag, leftEl); | ||
placeholder.remove(); | ||
@@ -225,4 +233,7 @@ clonePlaceholder.remove(); | ||
executeRemove() { | ||
if (this.param) { | ||
const el = this.editor.restoreSelection().focusNode.parentElement; | ||
if (this.param == "a") { | ||
this.editor.restoreSelection(); | ||
document.execCommand('unlink', false); | ||
} else if (this.param) { | ||
const el = this.editor.restoreSelection().focusNode.parentNode; | ||
const context = this.editor.createSelectionContext(el); | ||
@@ -560,3 +571,3 @@ | ||
unwrap(el) { | ||
const par = el.parentElement; | ||
const par = el.parentNode; | ||
while(el.firstChild) { | ||
@@ -642,6 +653,6 @@ par.insertBefore(el.firstChild, el); | ||
} else { | ||
if (ctxElem && ctxElem.nextElementSibling) { | ||
if (ctxElem && ctxElem.nextSibling) { | ||
const curParag = ctxElem; | ||
if (curParag) { | ||
curParag.parentElement.insertBefore(element, curParag.nextElementSibling); | ||
curParag.parentNode.insertBefore(element, curParag.nextSibling); | ||
} | ||
@@ -648,0 +659,0 @@ } else { |
{ | ||
"name": "lilium-text", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "Web rich text editor. Not ready to be used at all.", | ||
@@ -5,0 +5,0 @@ "main": "build/liliumtext.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
1379578
1967