@lrnwebcomponents/rich-text-editor
Advanced tools
Comparing version 8.0.0 to 8.0.1
@@ -125,3 +125,3 @@ /** | ||
return class extends RichTextEditorRangeBehaviors( | ||
SimpleToolbarButtonBehaviors(SuperClass) | ||
SimpleToolbarButtonBehaviors(SuperClass), | ||
) { | ||
@@ -136,3 +136,3 @@ /** | ||
static get styles() { | ||
return [...super.styles, ...RichTextToolbarStyles]; | ||
return [super.styles, ...RichTextToolbarStyles]; | ||
} | ||
@@ -156,3 +156,3 @@ render() { | ||
/** | ||
* The command used for document.execCommand. | ||
* The command used for globalThis.document.execCommand. | ||
*/ | ||
@@ -186,3 +186,3 @@ command: { | ||
/** | ||
* The command used for document.execCommand when toggled. | ||
* The command used for globalThis.document.execCommand when toggled. | ||
*/ | ||
@@ -232,3 +232,3 @@ toggledCommand: { | ||
/** | ||
* gets command param for document.execCommand | ||
* gets command param for globalThis.document.execCommand | ||
* @readonly | ||
@@ -242,3 +242,3 @@ */ | ||
/** | ||
* gets value param for document.execCommand | ||
* gets value param for globalThis.document.execCommand | ||
* @readonly | ||
@@ -319,3 +319,3 @@ */ | ||
detail: element, | ||
}) | ||
}), | ||
); | ||
@@ -332,3 +332,3 @@ } | ||
this.operationCommandVal, | ||
this.range | ||
this.range, | ||
); | ||
@@ -350,3 +350,3 @@ // optional callback so that custom buttons can perform | ||
}, | ||
}) | ||
}), | ||
); | ||
@@ -394,3 +394,3 @@ } | ||
if (this.range) { | ||
let div = document.createElement("div"), | ||
let div = globalThis.document.createElement("div"), | ||
contents = this.range.cloneContents(), | ||
@@ -397,0 +397,0 @@ val; |
@@ -21,3 +21,3 @@ /** | ||
class RichTextEditorEmojiPicker extends RichTextEditorPickerBehaviors( | ||
LitElement | ||
LitElement, | ||
) { | ||
@@ -33,3 +33,3 @@ /** | ||
static get styles() { | ||
return [...super.styles, css``]; | ||
return [super.styles, css``]; | ||
} | ||
@@ -36,0 +36,0 @@ |
@@ -20,3 +20,3 @@ /** | ||
class RichTextEditorHeadingPicker extends RichTextEditorPickerBehaviors( | ||
LitElement | ||
LitElement, | ||
) { | ||
@@ -122,4 +122,4 @@ /** | ||
RichTextEditorHeadingPicker.tag, | ||
RichTextEditorHeadingPicker | ||
RichTextEditorHeadingPicker, | ||
); | ||
export { RichTextEditorHeadingPicker }; |
@@ -21,3 +21,3 @@ /** | ||
class RichTextEditorIconPicker extends RichTextEditorPickerBehaviors( | ||
LitElement | ||
LitElement, | ||
) { | ||
@@ -34,3 +34,3 @@ /** | ||
return [ | ||
...super.styles, | ||
super.styles, | ||
css` | ||
@@ -37,0 +37,0 @@ #button.show-label::part(label) { |
@@ -20,3 +20,3 @@ /** | ||
class RichTextEditorImage extends RichTextEditorPromptButtonBehaviors( | ||
LitElement | ||
LitElement, | ||
) { | ||
@@ -23,0 +23,0 @@ /** |
@@ -29,3 +29,3 @@ /** | ||
class RichTextEditorLink extends RichTextEditorPromptButtonBehaviors( | ||
LitElement | ||
LitElement, | ||
) { | ||
@@ -32,0 +32,0 @@ /** |
@@ -29,3 +29,3 @@ /** | ||
return [ | ||
...super.styles, | ||
super.styles, | ||
css` | ||
@@ -123,3 +123,3 @@ :host { | ||
/** | ||
* command used for document.execCommand. | ||
* command used for globalThis.document.execCommand. | ||
*/ | ||
@@ -126,0 +126,0 @@ command: { |
@@ -119,3 +119,3 @@ /** | ||
let innerHTML = (this.fields || []).filter( | ||
(field) => field.property === "innerHTML" | ||
(field) => field.property === "innerHTML", | ||
); | ||
@@ -159,3 +159,3 @@ return innerHTML && innerHTML.length > 0; | ||
detail: this, | ||
}) | ||
}), | ||
); | ||
@@ -188,4 +188,4 @@ } | ||
: val[prop].trim | ||
? val[prop].trim() | ||
: val[prop]; | ||
? val[prop].trim() | ||
: val[prop]; | ||
@@ -217,3 +217,3 @@ return rawVal && rawVal !== "" ? rawVal : false; | ||
detail: this, | ||
}) | ||
}), | ||
); | ||
@@ -284,8 +284,8 @@ } | ||
class RichTextEditorPromptButton extends RichTextEditorPromptButtonBehaviors( | ||
LitElement | ||
LitElement, | ||
) {} | ||
customElements.define( | ||
RichTextEditorPromptButton.tag, | ||
RichTextEditorPromptButton | ||
RichTextEditorPromptButton, | ||
); | ||
export { RichTextEditorPromptButton, RichTextEditorPromptButtonBehaviors }; |
@@ -18,3 +18,3 @@ /** | ||
class RichTextEditorSourceCode extends RichTextEditorButtonBehaviors( | ||
LitElement | ||
LitElement, | ||
) { | ||
@@ -21,0 +21,0 @@ /** |
@@ -21,3 +21,3 @@ /** | ||
class RichTextEditorSymbolPicker extends RichTextEditorPickerBehaviors( | ||
LitElement | ||
LitElement, | ||
) { | ||
@@ -91,4 +91,4 @@ /** | ||
RichTextEditorSymbolPicker.tag, | ||
RichTextEditorSymbolPicker | ||
RichTextEditorSymbolPicker, | ||
); | ||
export { RichTextEditorSymbolPicker }; |
@@ -20,3 +20,3 @@ /** | ||
class RichTextEditorUnderline extends RichTextEditorPromptButtonBehaviors( | ||
LitElement | ||
LitElement, | ||
) { | ||
@@ -23,0 +23,0 @@ /** |
@@ -58,3 +58,3 @@ /** | ||
this.__textarea.select(); | ||
document.execCommand("paste"); | ||
globalThis.document.execCommand("paste"); | ||
}, 1); | ||
@@ -87,14 +87,15 @@ } | ||
// register globally so we can make sure there is only one | ||
window.RichTextEditorClipboard = window.RichTextEditorClipboard || {}; | ||
globalThis.RichTextEditorClipboard = globalThis.RichTextEditorClipboard || {}; | ||
// request if this exists. This helps invoke element existing in dom | ||
// as well as that there is only one of them. That way we can ensure everything | ||
// is rendered through same modal | ||
window.RichTextEditorClipboard.requestAvailability = () => { | ||
if (!window.RichTextEditorClipboard.instance) { | ||
window.RichTextEditorClipboard.instance = document.createElement( | ||
"rich-text-editor-clipboard" | ||
globalThis.RichTextEditorClipboard.requestAvailability = () => { | ||
if (!globalThis.RichTextEditorClipboard.instance) { | ||
globalThis.RichTextEditorClipboard.instance = | ||
globalThis.document.createElement("rich-text-editor-clipboard"); | ||
globalThis.document.body.appendChild( | ||
globalThis.RichTextEditorClipboard.instance, | ||
); | ||
document.body.appendChild(window.RichTextEditorClipboard.instance); | ||
} | ||
return window.RichTextEditorClipboard.instance; | ||
return globalThis.RichTextEditorClipboard.instance; | ||
}; |
@@ -83,3 +83,3 @@ /** | ||
}); | ||
document.body.append(this); | ||
globalThis.document.body.append(this); | ||
this.hidden = true; | ||
@@ -107,3 +107,3 @@ this.range = undefined; | ||
}); | ||
document.body.append(this); | ||
globalThis.document.body.append(this); | ||
this.hidden = true; | ||
@@ -117,14 +117,15 @@ this.range = range; | ||
// register globally so we can make sure there is only one | ||
window.RichTextEditorHighlight = window.RichTextEditorHighlight || {}; | ||
globalThis.RichTextEditorHighlight = globalThis.RichTextEditorHighlight || {}; | ||
// request if this exists. This helps invoke element existing in dom | ||
// as well as that there is only one of them. That way we can ensure everything | ||
// is rendered through same modal | ||
window.RichTextEditorHighlight.requestAvailability = () => { | ||
if (!window.RichTextEditorHighlight.instance) { | ||
window.RichTextEditorHighlight.instance = document.createElement( | ||
"rich-text-editor-highlight" | ||
globalThis.RichTextEditorHighlight.requestAvailability = () => { | ||
if (!globalThis.RichTextEditorHighlight.instance) { | ||
globalThis.RichTextEditorHighlight.instance = | ||
globalThis.document.createElement("rich-text-editor-highlight"); | ||
globalThis.document.body.appendChild( | ||
globalThis.RichTextEditorHighlight.instance, | ||
); | ||
document.body.appendChild(window.RichTextEditorHighlight.instance); | ||
} | ||
return window.RichTextEditorHighlight.instance; | ||
return globalThis.RichTextEditorHighlight.instance; | ||
}; |
@@ -190,9 +190,9 @@ /** | ||
this.haxUIElement = true; | ||
window.addEventListener( | ||
globalThis.addEventListener( | ||
"rich-text-editor-prompt-open", | ||
this.open.bind(this) | ||
this.open.bind(this), | ||
); | ||
// sets instance to current instance | ||
if (!window.RichTextEditorPrompt.instance) { | ||
window.RichTextEditorPrompt.instance = this; | ||
if (!globalThis.RichTextEditorPrompt.instance) { | ||
globalThis.RichTextEditorPrompt.instance = this; | ||
return this; | ||
@@ -213,3 +213,3 @@ } | ||
this.__highlight.addEventListener("change", (e) => | ||
setTimeout(this._handleChange(e), 300) | ||
setTimeout(this._handleChange(e), 300), | ||
); | ||
@@ -352,14 +352,15 @@ this.addEventListener("mousedown", (e) => (this.__retainFocus = true)); | ||
// register globally so we can make sure there is only one | ||
window.RichTextEditorPrompt = window.RichTextEditorPrompt || {}; | ||
globalThis.RichTextEditorPrompt = globalThis.RichTextEditorPrompt || {}; | ||
// request if this exists. This helps invoke element existing in dom | ||
// as well as that there is only one of them. That way we can ensure everything | ||
// is rendered through same modal | ||
window.RichTextEditorPrompt.requestAvailability = () => { | ||
if (!window.RichTextEditorPrompt.instance) { | ||
window.RichTextEditorPrompt.instance = document.createElement( | ||
"rich-text-editor-prompt" | ||
globalThis.RichTextEditorPrompt.requestAvailability = () => { | ||
if (!globalThis.RichTextEditorPrompt.instance) { | ||
globalThis.RichTextEditorPrompt.instance = | ||
globalThis.document.createElement("rich-text-editor-prompt"); | ||
globalThis.document.body.appendChild( | ||
globalThis.RichTextEditorPrompt.instance, | ||
); | ||
document.body.appendChild(window.RichTextEditorPrompt.instance); | ||
} | ||
return window.RichTextEditorPrompt.instance; | ||
return globalThis.RichTextEditorPrompt.instance; | ||
}; |
@@ -43,4 +43,6 @@ /** | ||
this.haxUIElement = true; | ||
this.__highlight = window.RichTextEditorHighlight.requestAvailability(); | ||
this.__clipboard = window.RichTextEditorClipboard.requestAvailability(); | ||
this.__highlight = | ||
globalThis.RichTextEditorHighlight.requestAvailability(); | ||
this.__clipboard = | ||
globalThis.RichTextEditorClipboard.requestAvailability(); | ||
} | ||
@@ -133,3 +135,3 @@ | ||
toolbar.target = undefined; | ||
document.body.append(toolbar); | ||
globalThis.document.body.append(toolbar); | ||
} | ||
@@ -207,3 +209,3 @@ /* ------ HANDLES CLIPBOARD AND HTML ------------------------- */ | ||
detail: this.target, | ||
}) | ||
}), | ||
); | ||
@@ -213,6 +215,6 @@ let target = this.__toolbar.target; | ||
let range = this.range, | ||
div = document.createElement("div"), | ||
div = globalThis.document.createElement("div"), | ||
parent = range.commonAncestorContainer.parentNode, | ||
closest = parent.closest( | ||
"[contenteditable=true]:not([disabled]),input:not([disabled]),textarea:not([disabled])" | ||
"[contenteditable=true]:not([disabled]),input:not([disabled]),textarea:not([disabled])", | ||
); | ||
@@ -254,3 +256,3 @@ if ((target = closest)) { | ||
? this.__toolbar.getSelection() | ||
: window.getSelection(); | ||
: globalThis.getSelection(); | ||
} | ||
@@ -269,4 +271,4 @@ | ||
: node.parentNode | ||
? this.getRoot(node.parentNode) | ||
: node; | ||
? this.getRoot(node.parentNode) | ||
: node; | ||
} | ||
@@ -295,7 +297,7 @@ debugRange(range = this.getRange()) { | ||
command = this.command, | ||
commandVal = this.commandVal | ||
commandVal = this.commandVal, | ||
) { | ||
let query = | ||
!!range && !!command | ||
? document.queryCommandState(this.command) | ||
? globalThis.document.queryCommandState(this.command) | ||
: false, | ||
@@ -307,4 +309,4 @@ /* workaround because queryCommandState("underline") returns true on links */ | ||
: command === "wrapRange" | ||
? !!this.rangeOrMatchingAncestor(commandVal) | ||
: query; | ||
? !!this.rangeOrMatchingAncestor(commandVal) | ||
: query; | ||
return !!block ? true : false; | ||
@@ -334,3 +336,3 @@ } | ||
cssQuery = this.tagsList || "", | ||
range = this.range || this.getRange() | ||
range = this.range || this.getRange(), | ||
) { | ||
@@ -342,4 +344,4 @@ let start = this.rangeElementOrParentElement(range); | ||
: start.matches(cssQuery) | ||
? start | ||
: start.closest(cssQuery); | ||
? start | ||
: start.closest(cssQuery); | ||
} | ||
@@ -423,4 +425,4 @@ /** | ||
: common.nodeType == 1 | ||
? common | ||
: common.parentElement; | ||
? common | ||
: common.parentElement; | ||
} | ||
@@ -488,3 +490,3 @@ /** | ||
let sel = this.getSelection(); | ||
range = document.createRange(); | ||
range = globalThis.document.createRange(); | ||
sel.removeAllRanges(); | ||
@@ -507,3 +509,3 @@ sel.addRange(range); | ||
let sel = this.getSelection(); | ||
range = document.createRange(); | ||
range = globalThis.document.createRange(); | ||
sel.removeAllRanges(); | ||
@@ -576,3 +578,3 @@ sel.addRange(range); | ||
}, | ||
}) | ||
}), | ||
); | ||
@@ -586,3 +588,3 @@ } | ||
this.__source = | ||
this.__source || window.RichTextEditorSource.requestAvailability(); | ||
this.__source || globalThis.RichTextEditorSource.requestAvailability(); | ||
} | ||
@@ -609,3 +611,3 @@ /** | ||
"wrapRange", | ||
commandVal | ||
commandVal, | ||
), | ||
@@ -634,3 +636,3 @@ node = this.rangeOrMatchingAncestor(commandVal); | ||
} | ||
if (this.__highlight.parentNode === document.body) | ||
if (this.__highlight.parentNode === globalThis.document.body) | ||
this.__highlight.wrap(range); | ||
@@ -641,3 +643,3 @@ this.__highlight.unwrap(range); | ||
if (command != "paste" && command != "wrapRange") { | ||
document.execCommand(command, false, commandVal); | ||
globalThis.document.execCommand(command, false, commandVal); | ||
target.normalize(); | ||
@@ -644,0 +646,0 @@ } else if (navigator.clipboard && command == "paste") { |
@@ -174,4 +174,4 @@ /** | ||
// sets instance to current instance | ||
if (!window.RichTextEditorSource.instance) { | ||
window.RichTextEditorSource.instance = this; | ||
if (!globalThis.RichTextEditorSource.instance) { | ||
globalThis.RichTextEditorSource.instance = this; | ||
return this; | ||
@@ -203,6 +203,6 @@ } | ||
...document.querySelectorAll( | ||
"[data-rich-text-editor-view-source-mode]" | ||
"[data-rich-text-editor-view-source-mode]", | ||
), | ||
].forEach((node) => | ||
node.removeAttribute("data-rich-text-editor-view-source-mode") | ||
node.removeAttribute("data-rich-text-editor-view-source-mode"), | ||
); | ||
@@ -216,3 +216,3 @@ if (this.__target) this.__target.focus(); | ||
this.innerHTML = this.__codeEditorValue; | ||
document.body.append(this); | ||
globalThis.document.body.append(this); | ||
} else { | ||
@@ -224,3 +224,3 @@ this.__toolbar = toolbar; | ||
"data-rich-text-editor-view-source-mode", | ||
true | ||
true, | ||
); | ||
@@ -261,17 +261,21 @@ this.__target.parentNode.insertBefore(this, this.__target); | ||
// register globally so we can make sure there is only one | ||
window.RichTextEditorSource = window.RichTextEditorSource || {}; | ||
globalThis.RichTextEditorSource = globalThis.RichTextEditorSource || {}; | ||
// request if this exists. This helps invoke element existing in dom | ||
// as well as that there is only one of them. That way we can ensure everything | ||
// is rendered through same modal | ||
window.RichTextEditorSource.requestAvailability = () => { | ||
if (!window.RichTextEditorSource.instance) { | ||
window.RichTextEditorSource.instance = document.createElement( | ||
"rich-text-editor-source" | ||
globalThis.RichTextEditorSource.requestAvailability = () => { | ||
if (!globalThis.RichTextEditorSource.instance) { | ||
globalThis.RichTextEditorSource.instance = | ||
globalThis.document.createElement("rich-text-editor-source"); | ||
globalThis.RichTextEditorSource.stylesheet = | ||
globalThis.document.createElement("style"); | ||
globalThis.RichTextEditorSource.stylesheet.innerHTML = `rich-text-editor-source + [data-rich-text-editor-view-source-mode] { display: none }`; | ||
globalThis.document.body.appendChild( | ||
globalThis.RichTextEditorSource.instance, | ||
); | ||
window.RichTextEditorSource.stylesheet = document.createElement("style"); | ||
window.RichTextEditorSource.stylesheet.innerHTML = `rich-text-editor-source + [data-rich-text-editor-view-source-mode] { display: none }`; | ||
document.body.appendChild(window.RichTextEditorSource.instance); | ||
document.head.appendChild(window.RichTextEditorSource.stylesheet); | ||
globalThis.document.head.appendChild( | ||
globalThis.RichTextEditorSource.stylesheet, | ||
); | ||
} | ||
return window.RichTextEditorSource.instance; | ||
return globalThis.RichTextEditorSource.instance; | ||
}; |
@@ -26,3 +26,3 @@ /** | ||
class RichTextEditorBreadcrumbs extends RichTextEditorRangeBehaviors( | ||
LitElement | ||
LitElement, | ||
) { | ||
@@ -112,3 +112,3 @@ /** | ||
: html` <span class="divider"> > </span> `} | ||
` | ||
`, | ||
)} | ||
@@ -115,0 +115,0 @@ `; |
@@ -22,3 +22,3 @@ /** | ||
class RichTextEditorToolbarFull extends RichTextEditorToolbarBehaviors( | ||
LitElement | ||
LitElement, | ||
) { | ||
@@ -25,0 +25,0 @@ /** |
@@ -21,3 +21,3 @@ /** | ||
class RichTextEditorToolbarMini extends RichTextEditorToolbarBehaviors( | ||
LitElement | ||
LitElement, | ||
) { | ||
@@ -24,0 +24,0 @@ /** |
@@ -26,3 +26,3 @@ /** | ||
window.RichTextEditorToolbars = window.RichTextEditorToolbars || []; | ||
globalThis.RichTextEditorToolbars = globalThis.RichTextEditorToolbars || []; | ||
/** | ||
@@ -40,3 +40,3 @@ * RichTextEditorToolbarBehaviors | ||
return class extends RichTextEditorRangeBehaviors( | ||
SimpleToolbarBehaviors(SuperClass) | ||
SimpleToolbarBehaviors(SuperClass), | ||
) { | ||
@@ -910,6 +910,6 @@ /** | ||
this.__toolbar = this; | ||
document.addEventListener( | ||
globalThis.document.addEventListener( | ||
shadow.eventName, | ||
this._handleTargetSelection.bind(this.__toolbar), | ||
{ signal: this.windowControllers.signal } | ||
{ signal: this.windowControllers.signal }, | ||
); | ||
@@ -923,3 +923,3 @@ | ||
super.connectedCallback(); | ||
window.RichTextEditorToolbars.push(this); | ||
globalThis.RichTextEditorToolbars.push(this); | ||
} | ||
@@ -933,5 +933,4 @@ | ||
this.windowControllers.abort(); | ||
window.RichTextEditorToolbars = window.RichTextEditorToolbars.filter( | ||
(toolbar) => toolbar !== this | ||
); | ||
globalThis.RichTextEditorToolbars = | ||
globalThis.RichTextEditorToolbars.filter((toolbar) => toolbar !== this); | ||
super.disconnectedCallback(); | ||
@@ -945,3 +944,3 @@ } | ||
this.positionByTarget(this.editor); | ||
this.__prompt = window.RichTextEditorPrompt.requestAvailability(); | ||
this.__prompt = globalThis.RichTextEditorPrompt.requestAvailability(); | ||
this.__prompt.addEventListener("open", (e) => { | ||
@@ -959,3 +958,3 @@ this.__promptOpen = true; | ||
super.updated(changedProperties); | ||
changedProperties.forEach((oldValue, propName) => { | ||
changedProperties.forEach((oldValue, propName) => { | ||
if (propName === "range") this._rangeChanged(this.range, oldValue); | ||
@@ -992,4 +991,4 @@ if (propName === "config") this.updateToolbar(); | ||
: this.show != "selection" | ||
? !this.target | ||
: this.noSelection; | ||
? !this.target | ||
: this.noSelection; | ||
} | ||
@@ -1042,3 +1041,3 @@ /** | ||
detail: this, | ||
}) | ||
}), | ||
); | ||
@@ -1062,3 +1061,3 @@ } | ||
detail: this, | ||
}) | ||
}), | ||
); | ||
@@ -1078,3 +1077,3 @@ } | ||
detail: this, | ||
}) | ||
}), | ||
); | ||
@@ -1130,3 +1129,3 @@ } | ||
detail: this, | ||
}) | ||
}), | ||
); | ||
@@ -1156,3 +1155,3 @@ } | ||
(button.tagsArray || []).forEach( | ||
(tag) => delete this.clickableElements[tag] | ||
(tag) => delete this.clickableElements[tag], | ||
); | ||
@@ -1185,6 +1184,6 @@ } | ||
if (!this.breadcrumbs) { | ||
this.breadcrumbs = document.createElement( | ||
"rich-text-editor-breadcrumbs" | ||
this.breadcrumbs = globalThis.document.createElement( | ||
"rich-text-editor-breadcrumbs", | ||
); | ||
document.body.appendChild(this.breadcrumbs); | ||
globalThis.document.body.appendChild(this.breadcrumbs); | ||
} | ||
@@ -1296,3 +1295,3 @@ this.breadcrumbs.label = this.breadcrumbsLabel; | ||
this.breadcrumbs, | ||
this.target.nextSibling | ||
this.target.nextSibling, | ||
); | ||
@@ -1302,6 +1301,6 @@ this.breadcrumbs.slot = target.slot; | ||
} else { | ||
document.body.append(this); | ||
globalThis.document.body.append(this); | ||
this.slot = undefined; | ||
if (this.breadcrumbs) { | ||
document.body.append(this.breadcrumbs); | ||
globalThis.document.body.append(this.breadcrumbs); | ||
this.breadcrumbs.slot = undefined; | ||
@@ -1328,3 +1327,3 @@ } | ||
Object.keys(handlers).forEach((handler) => | ||
target.removeEventListener(handler, handlers[handler]) | ||
target.removeEventListener(handler, handlers[handler]), | ||
); | ||
@@ -1348,3 +1347,3 @@ | ||
.trim(), | ||
}) | ||
}), | ||
); | ||
@@ -1368,3 +1367,3 @@ } | ||
Object.keys(handlers).forEach((handler) => | ||
target.removeEventListener(handler, handlers[handler]) | ||
target.removeEventListener(handler, handlers[handler]), | ||
); | ||
@@ -1381,3 +1380,3 @@ | ||
.trim(), | ||
}) | ||
}), | ||
); | ||
@@ -1394,3 +1393,3 @@ } | ||
insertNew(target) { | ||
let content = document.createElement("rich-text-editor"); | ||
let content = globalThis.document.createElement("rich-text-editor"); | ||
target.parentNode.insertBefore(content, target); | ||
@@ -1449,4 +1448,4 @@ content.appendChild(target); | ||
: this.target && this.target.innerHTML | ||
? this.target.innerHTML | ||
: ""; | ||
? this.target.innerHTML | ||
: ""; | ||
} | ||
@@ -1470,3 +1469,3 @@ setTarget(target) { | ||
Object.keys(handlers).forEach((handler) => | ||
target.addEventListener(handler, handlers[handler]) | ||
target.addEventListener(handler, handlers[handler]), | ||
); | ||
@@ -1494,3 +1493,3 @@ this.getRoot(target).onselectionchange = (e) => { | ||
Object.keys(handlers).forEach((handler) => | ||
target.removeEventListener(handler, handlers[handler]) | ||
target.removeEventListener(handler, handlers[handler]), | ||
); | ||
@@ -1674,5 +1673,5 @@ this.target = undefined; | ||
class RichTextEditorToolbar extends RichTextEditorToolbarBehaviors( | ||
LitElement | ||
LitElement, | ||
) {} | ||
customElements.define(RichTextEditorToolbar.tag, RichTextEditorToolbar); | ||
export { RichTextEditorToolbar, RichTextEditorToolbarBehaviors }; |
@@ -22,3 +22,3 @@ { | ||
}, | ||
"version": "8.0.0", | ||
"version": "8.0.1", | ||
"description": "a standalone rich text editor", | ||
@@ -39,33 +39,34 @@ "repository": { | ||
"lighthouse": "gulp lighthouse --gulpfile=gulpfile.cjs", | ||
"test:watch": "web-test-runner \"test/**/*.test.js\" --node-resolve --config=../../web-test-runner.config.mjs --playwright --browsers chromium firefox --watch", | ||
"test": "web-test-runner \"test/**/*.test.js\" --node-resolve --config=../../web-test-runner.config.mjs --playwright --browsers chromium firefox" | ||
"test:watch": "web-test-runner \"test/**/*.test.js\" --node-resolve --config=../../web-test-runner.config.mjs --playwright --browsers chromium --watch", | ||
"test": "web-test-runner \"test/**/*.test.js\" --node-resolve --config=../../web-test-runner.config.mjs --playwright --browsers chromium" | ||
}, | ||
"author": { | ||
"name": "nikkimk" | ||
"name": "haxtheweb", | ||
"url": "https://hax.psu.edu/" | ||
}, | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"@lrnwebcomponents/absolute-position-behavior": "^8.0.0", | ||
"@lrnwebcomponents/code-editor": "^8.0.0", | ||
"@lrnwebcomponents/md-extra-icons": "^8.0.0", | ||
"@lrnwebcomponents/simple-fields": "^8.0.0", | ||
"@lrnwebcomponents/simple-icon": "^8.0.0", | ||
"@lrnwebcomponents/simple-icon-picker": "^8.0.0", | ||
"@lrnwebcomponents/simple-picker": "^8.0.0", | ||
"@lrnwebcomponents/simple-popover": "^8.0.0", | ||
"@lrnwebcomponents/simple-toolbar": "^8.0.0", | ||
"@lrnwebcomponents/utils": "^8.0.0", | ||
"@lrnwebcomponents/absolute-position-behavior": "^8.0.1", | ||
"@lrnwebcomponents/code-editor": "^8.0.1", | ||
"@lrnwebcomponents/md-extra-icons": "^8.0.1", | ||
"@lrnwebcomponents/simple-fields": "^8.0.1", | ||
"@lrnwebcomponents/simple-icon": "^8.0.1", | ||
"@lrnwebcomponents/simple-icon-picker": "^8.0.1", | ||
"@lrnwebcomponents/simple-picker": "^8.0.1", | ||
"@lrnwebcomponents/simple-popover": "^8.0.1", | ||
"@lrnwebcomponents/simple-toolbar": "^8.0.1", | ||
"@lrnwebcomponents/utils": "^8.0.1", | ||
"@polymer/iron-icons": "^3.0.1", | ||
"lit": "^3.1.0", | ||
"lit": "^3.1.2", | ||
"shadow-selection-polyfill": "^1.1.0" | ||
}, | ||
"devDependencies": { | ||
"@lrnwebcomponents/deduping-fix": "^8.0.0", | ||
"@lrnwebcomponents/storybook-utilities": "^8.0.0", | ||
"@open-wc/testing": "3.2.0", | ||
"@lrnwebcomponents/deduping-fix": "^8.0.1", | ||
"@lrnwebcomponents/storybook-utilities": "^8.0.1", | ||
"@open-wc/testing": "4.0.0", | ||
"@polymer/iron-component-page": "github:PolymerElements/iron-component-page", | ||
"@polymer/iron-demo-helpers": "3.1.0", | ||
"@web/dev-server": "0.3.1", | ||
"@web/dev-server": "0.4.2", | ||
"@webcomponents/webcomponentsjs": "^2.8.0", | ||
"concurrently": "8.2.0", | ||
"concurrently": "8.2.2", | ||
"wct-browser-legacy": "1.0.2" | ||
@@ -81,3 +82,3 @@ }, | ||
], | ||
"gitHead": "2791492ff7ab40c7d4c827c4b305e33c0a971230" | ||
"gitHead": "246242dfc335bb0f3baa59f801241be9d3b69180" | ||
} |
@@ -325,3 +325,3 @@ /** | ||
detail: this.querySelector("*"), | ||
}) | ||
}), | ||
); | ||
@@ -355,3 +355,3 @@ } | ||
detail: this, | ||
}) | ||
}), | ||
); | ||
@@ -374,3 +374,3 @@ } | ||
: (window.RichTextEditorToolbars || []).filter( | ||
(toolbar) => toolbar.id === this.toolbarId | ||
(toolbar) => toolbar.id === this.toolbarId, | ||
); | ||
@@ -382,3 +382,3 @@ //get toolbar by type | ||
: (window.RichTextEditorToolbars || []).filter( | ||
(toolbar) => toolbar.type === this.type | ||
(toolbar) => toolbar.type === this.type, | ||
); | ||
@@ -393,3 +393,3 @@ } | ||
toolbar = document.createElement( | ||
this.type || "rich-text-editor-toolbar" | ||
this.type || "rich-text-editor-toolbar", | ||
); | ||
@@ -396,0 +396,0 @@ } |
@@ -55,3 +55,3 @@ import { html } from "lit-html"; | ||
type: utils.randomOption(toolbars), | ||
}) | ||
}), | ||
); | ||
@@ -420,4 +420,4 @@ }; | ||
knobs.props.id.knob, | ||
knobs.props.config ? knobs.props.config.knob : [] | ||
)}` | ||
knobs.props.config ? knobs.props.config.knob : [], | ||
)}`, | ||
); | ||
@@ -434,4 +434,4 @@ }; | ||
knobs.props.id.knob, | ||
knobs.props.config ? knobs.props.config.knob : [] | ||
)}` | ||
knobs.props.config ? knobs.props.config.knob : [], | ||
)}`, | ||
); | ||
@@ -535,3 +535,3 @@ }; | ||
knobs, | ||
true | ||
true, | ||
)} | ||
@@ -538,0 +538,0 @@ <figure style="max-width: 300px; border: 1px solid black;"> |
@@ -325,3 +325,3 @@ /** | ||
detail: this.querySelector("*"), | ||
}) | ||
}), | ||
); | ||
@@ -355,3 +355,3 @@ } | ||
detail: this, | ||
}) | ||
}), | ||
); | ||
@@ -374,3 +374,3 @@ } | ||
: (window.RichTextEditorToolbars || []).filter( | ||
(toolbar) => toolbar.id === this.toolbarId | ||
(toolbar) => toolbar.id === this.toolbarId, | ||
); | ||
@@ -382,3 +382,3 @@ //get toolbar by type | ||
: (window.RichTextEditorToolbars || []).filter( | ||
(toolbar) => toolbar.type === this.type | ||
(toolbar) => toolbar.type === this.type, | ||
); | ||
@@ -393,3 +393,3 @@ } | ||
toolbar = document.createElement( | ||
this.type || "rich-text-editor-toolbar" | ||
this.type || "rich-text-editor-toolbar", | ||
); | ||
@@ -396,0 +396,0 @@ } |
@@ -8,12 +8,10 @@ import { fixture, expect, html } from "@open-wc/testing"; | ||
beforeEach(async () => { | ||
element = await fixture( | ||
html` | ||
<rich-text-editor> | ||
<p> | ||
I'm the <a href="#top">easiest</a> way to implement editable rich | ||
text. | ||
</p> | ||
</rich-text-editor> | ||
` | ||
); | ||
element = await fixture(html` | ||
<rich-text-editor> | ||
<p> | ||
I'm the <a href="#top">easiest</a> way to implement editable rich | ||
text. | ||
</p> | ||
</rich-text-editor> | ||
`); | ||
}); | ||
@@ -20,0 +18,0 @@ |
487086
10364
Updatedlit@^3.1.2