lexxy 0.9.16 → 0.9.17

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3cb17d4a19645528ae798085629d65aab74bb6be8376c95efa8f038b2709a3b0
4
- data.tar.gz: feac15b5a21f774676ff3f17716fedb4a79ff2f187a7462530913398d638f742
3
+ metadata.gz: bd7e6d4971352233c9eaf05d0501f780dcf7029822385349c310a4c84c7198a6
4
+ data.tar.gz: 62ee0a3aa3009089c6bfbd3bd089afe40e4e7abe7cdba70efe45e20b137d0afe
5
5
  SHA512:
6
- metadata.gz: 634cdfcb73ebf17c42589dc239e0168779988fd6e945b3bc14090cd1f7a4f05d106b68cd6db207195a65c765afa12893b30b042199bbb24e8e47692828a4eb72
7
- data.tar.gz: abec438ca81c779c1fb6fdffbae0aabe918975ee4fcf5401671f68c9f4e88251be035bf11491a3582548de33f6f1f6d4a3c0a5d5c0f4dc33b0d18f5076480075
6
+ metadata.gz: 77269a9a5bc4bfee9da077aec96649b68b7cf3a128f0b76c82c0d0b668d7e1e03a15ee83d04816e5dee8a4b82d90e98d7c230913a2b3a40d3cacf00637cbf41c
7
+ data.tar.gz: 436e73b527e5e5e9305fa5d8803194f06359e84a6a7f19f35575ec27caa8336f96843ce342f1ded93f88cce8d34dc0f3c46fb163d6cc9e951cdf905f953c3ac3
@@ -14267,9 +14267,7 @@ class LexicalEditorElement extends HTMLElement {
14267
14267
  }
14268
14268
 
14269
14269
  get value() {
14270
- return this.cachedValue ??= this.editor?.read(() => {
14271
- return sanitize(ht$1(this.editor, null))
14272
- }) ?? null
14270
+ return this.cachedValue ??= this.#readSanitizedEditorValue()
14273
14271
  }
14274
14272
 
14275
14273
  set value(html) {
@@ -14298,6 +14296,12 @@ class LexicalEditorElement extends HTMLElement {
14298
14296
  return this.#historyState.redo
14299
14297
  }
14300
14298
 
14299
+ #readSanitizedEditorValue(editor = this.editor) {
14300
+ return editor?.read(() => {
14301
+ return sanitize(ht$1(this.editor, null))
14302
+ }) ?? null
14303
+ }
14304
+
14301
14305
  #parseHtmlIntoLexicalNodes(html, { editor = this.editor } = {}) {
14302
14306
  if (!html) html = "<p></p>";
14303
14307
  const nodes = this.$generateNodesFromDOM(parseHtml(`${html}`), { editor });
@@ -14335,7 +14339,6 @@ class LexicalEditorElement extends HTMLElement {
14335
14339
  this.#registerFileAcceptFilter();
14336
14340
  this.#attachDebugHooks();
14337
14341
  this.#attachToolbar();
14338
- this.#configureSanitizer();
14339
14342
  this.#resetBeforeTurboCaches();
14340
14343
  }
14341
14344
 
@@ -14361,7 +14364,11 @@ class LexicalEditorElement extends HTMLElement {
14361
14364
  html: {
14362
14365
  export: new Map([ [ gr, exportTextNodeDOM ], [ K$1, exportTextNodeDOM ] ])
14363
14366
  },
14364
- $initialEditorState: (editor) => this.#loadInitialValue(editor)
14367
+ $initialEditorState: (editor) => {
14368
+ this.#configureSanitizer(editor);
14369
+ this.#loadInitialValue(editor);
14370
+ this.#setInternalFormValue(this.#readSanitizedEditorValue(editor));
14371
+ },
14365
14372
  },
14366
14373
  ...this.extensions.lexicalExtensions
14367
14374
  );
@@ -14443,7 +14450,6 @@ class LexicalEditorElement extends HTMLElement {
14443
14450
  const initialHtml = this.valueBeforeDisconnect || this.getAttribute("value") || "<p><br></p>";
14444
14451
 
14445
14452
  this.#initialValue = initialHtml;
14446
- this.#setInternalFormValue(initialHtml);
14447
14453
  this.#setEditorHtml(initialHtml, { editor });
14448
14454
  }
14449
14455
 
@@ -14670,16 +14676,16 @@ class LexicalEditorElement extends HTMLElement {
14670
14676
  this.classList.toggle("lexxy-editor--empty", this.isEmpty);
14671
14677
  }
14672
14678
 
14673
- #configureSanitizer() {
14674
- setSanitizerConfig(this.#allowedElements);
14679
+ #configureSanitizer(editor) {
14680
+ setSanitizerConfig(this.#getAllowedElements(editor));
14675
14681
  }
14676
14682
 
14677
- get #allowedElements() {
14678
- return this.#importableTags.concat(this.extensions.allowedElements)
14683
+ #getAllowedElements(editor) {
14684
+ return this.#getImportableTags(editor).concat(this.extensions.allowedElements)
14679
14685
  }
14680
14686
 
14681
- get #importableTags() {
14682
- const tags = Array.from(this.editor._htmlConversions.keys());
14687
+ #getImportableTags(editor) {
14688
+ const tags = Array.from(editor._htmlConversions.keys());
14683
14689
  return tags.filter(tag => !tag.startsWith("#"))
14684
14690
  }
14685
14691
 
Binary file
Binary file