@37signals/lexxy 0.1.8-beta → 0.1.9-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lexxy.esm.js +13 -4
- package/package.json +2 -1
package/dist/lexxy.esm.js
CHANGED
|
@@ -5,9 +5,10 @@ import { $isQuoteNode, $isHeadingNode, $createQuoteNode, $createHeadingNode, Quo
|
|
|
5
5
|
import { $isCodeNode, $isCodeHighlightNode, CodeNode, CodeHighlightNode, registerCodeHighlighting, CODE_LANGUAGE_FRIENDLY_NAME_MAP, normalizeCodeLang } from '@lexical/code';
|
|
6
6
|
import { $isLinkNode, $toggleLink, LinkNode, AutoLinkNode } from '@lexical/link';
|
|
7
7
|
import { $generateNodesFromDOM, $generateHtmlFromNodes } from '@lexical/html';
|
|
8
|
-
import {
|
|
8
|
+
import { registerMarkdownShortcuts, TRANSFORMERS } from '@lexical/markdown';
|
|
9
9
|
import { registerHistory, createEmptyHistoryState } from '@lexical/history';
|
|
10
10
|
import { DirectUpload } from '@rails/activestorage';
|
|
11
|
+
import { marked } from 'marked';
|
|
11
12
|
import 'prismjs/components/prism-ruby';
|
|
12
13
|
|
|
13
14
|
DOMPurify.addHook("uponSanitizeElement", (node, data) => {
|
|
@@ -16,6 +17,11 @@ DOMPurify.addHook("uponSanitizeElement", (node, data) => {
|
|
|
16
17
|
}
|
|
17
18
|
});
|
|
18
19
|
|
|
20
|
+
const getNonce = () => {
|
|
21
|
+
const element = document.head.querySelector("meta[name=csp-nonce]");
|
|
22
|
+
return element?.content
|
|
23
|
+
};
|
|
24
|
+
|
|
19
25
|
function getNearestListItemNode(node) {
|
|
20
26
|
let current = node;
|
|
21
27
|
while (current !== null) {
|
|
@@ -209,6 +215,7 @@ class LexicalToolbarElement extends HTMLElement {
|
|
|
209
215
|
this.#compactMenu();
|
|
210
216
|
|
|
211
217
|
this.#overflow.style.display = this.#overflowMenu.children.length ? "block" : "none";
|
|
218
|
+
this.#overflow.setAttribute("nonce", getNonce());
|
|
212
219
|
}
|
|
213
220
|
|
|
214
221
|
get #overflow() {
|
|
@@ -1399,6 +1406,7 @@ class Selection {
|
|
|
1399
1406
|
marker.style.width = "1px";
|
|
1400
1407
|
marker.style.height = "1em";
|
|
1401
1408
|
marker.style.lineHeight = "normal";
|
|
1409
|
+
marker.setAttribute("nonce", getNonce());
|
|
1402
1410
|
return marker
|
|
1403
1411
|
}
|
|
1404
1412
|
|
|
@@ -2062,9 +2070,8 @@ class Clipboard {
|
|
|
2062
2070
|
}
|
|
2063
2071
|
|
|
2064
2072
|
#pasteMarkdown(text) {
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
});
|
|
2073
|
+
const html = marked(text);
|
|
2074
|
+
this.contents.insertHtml(html);
|
|
2068
2075
|
}
|
|
2069
2076
|
|
|
2070
2077
|
#handlePastedFiles(clipboardData) {
|
|
@@ -3065,6 +3072,7 @@ class LexicalPromptElement extends HTMLElement {
|
|
|
3065
3072
|
const popoverContainer = createElement("ul", { role: "listbox", id: generateDomId("prompt-popover") }); // Avoiding [popover] due to not being able to position at an arbitrary X, Y position.
|
|
3066
3073
|
popoverContainer.classList.add("lexxy-prompt-menu");
|
|
3067
3074
|
popoverContainer.style.position = "absolute";
|
|
3075
|
+
popoverContainer.setAttribute("nonce", getNonce());
|
|
3068
3076
|
popoverContainer.append(...(await this.source.buildListItems()));
|
|
3069
3077
|
popoverContainer.addEventListener("click", this.#handlePopoverClick);
|
|
3070
3078
|
this.#editorElement.appendChild(popoverContainer);
|
|
@@ -3099,6 +3107,7 @@ class CodeLanguagePicker extends HTMLElement {
|
|
|
3099
3107
|
});
|
|
3100
3108
|
|
|
3101
3109
|
this.languagePickerElement.style.position = "absolute";
|
|
3110
|
+
this.languagePickerElement.setAttribute("nonce", getNonce());
|
|
3102
3111
|
this.editorElement.appendChild(this.languagePickerElement);
|
|
3103
3112
|
}
|
|
3104
3113
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@37signals/lexxy",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9-beta",
|
|
4
4
|
"description": "Lexxy - A modern rich text editor for Rails.",
|
|
5
5
|
"module": "dist/lexxy.esm.js",
|
|
6
6
|
"type": "module",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"@lexical/table": "^0.32.1",
|
|
38
38
|
"@lexical/utils": "^0.32.1",
|
|
39
39
|
"dompurify": "^3.2.6",
|
|
40
|
+
"marked": "^16.3.0",
|
|
40
41
|
"prismjs": "^1.30.0"
|
|
41
42
|
},
|
|
42
43
|
"peerDependencies": {
|