lexxy 0.9.6.beta → 0.9.7.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b3e32d6616564bae023ac462dadcbc6a9b3ca526e152d1f0166233e64483548
4
- data.tar.gz: c8f19bbac5ae8129e4b70e769233005598005b04f9820e4f025dccaca67ced73
3
+ metadata.gz: d626ffd428a2d550fb3439d9ee89e2e71a86f6bdaa3a990d5c5f8954394e5529
4
+ data.tar.gz: 98f0d3b26df745b0a6477e508de91bf2f9be89c079fccf3f3d53648c92d311b6
5
5
  SHA512:
6
- metadata.gz: 5f4862084d7dd764d555ab65995f005249071ab747314ee499150f2708b2ec09af785f0347fd3dc5a7039d61a9b64889f5300a47ea463171633bd865c521ce6b
7
- data.tar.gz: a1eb5afc29e8ef304c534bb75c9375d0f3dbc80aafbb55ab7981ff8de9043acbf9f07ac88569d46fe0824c6da41759d42330e300acf9a8083c1fdf2bed0f8cac
6
+ metadata.gz: 286a01f5de6b3d69347a1a40f54709718e245c4de7f3cca176635a2acb44fcea5e19d78f5fac1b9aaef66c1671d920073700c28918350d3d62f20e71931fa6dd
7
+ data.tar.gz: 0003b9f77dc7c231067a69ca758626941df4cec24393d3f897b6705b3526e5e8260f290f9fa8591bf7a3d982e4fac3e2033a9aaa16ce33b9665a60f2d4f9c4fd
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  A modern rich text editor for Rails.
4
4
 
5
5
  > [!IMPORTANT]
6
- > This is an early beta. It hasn't been battle-tested yet. Please try it out and report any issues you find.
6
+ > This is a beta. It hasn't been battle-tested yet. Please try it out and report any issues you find.
7
7
 
8
8
  **[Try it out!](https://basecamp.github.io/lexxy/try-it)**
9
9
 
@@ -26,7 +26,7 @@ Visit the **[documentation site](https://basecamp.github.io/lexxy)**.
26
26
 
27
27
  ## Roadmap
28
28
 
29
- This is an early beta. Here's what's coming next:
29
+ This is a beta. Here's what's coming next:
30
30
 
31
31
  - [x] Configurable editors in Action Text: Choose your editor like you choose your database.
32
32
  - [x] More editing features:
@@ -6247,7 +6247,7 @@ purify.addHook("uponSanitizeElement", (node, data) => {
6247
6247
  }
6248
6248
  });
6249
6249
 
6250
- function buildConfig(allowedElements) {
6250
+ function buildConfig(allowedElements ) {
6251
6251
  const tagAttributes = {};
6252
6252
 
6253
6253
  for (const element of allowedElements) {
@@ -7551,15 +7551,12 @@ var Lexxy = {
7551
7551
  }
7552
7552
  };
7553
7553
 
7554
- function sanitize(html, allowedElements) {
7555
- return purify.sanitize(html, buildConfig(allowedElements))
7554
+ function setSanitizerConfig(allowedTags) {
7555
+ purify.clearConfig();
7556
+ purify.setConfig(buildConfig(allowedTags));
7556
7557
  }
7557
7558
 
7558
- // Sanitize HTML for custom attachment content (mentions, cards, etc.).
7559
- // Uses DOMPurify defaults to strip XSS vectors (scripts, event handlers)
7560
- // while preserving the richer tag set that server-rendered attachment
7561
- // content legitimately uses (e.g. <span>, <div>, <img>).
7562
- function sanitizeAttachmentContent(html) {
7559
+ function sanitize(html) {
7563
7560
  return purify.sanitize(html)
7564
7561
  }
7565
7562
 
@@ -7655,7 +7652,7 @@ class CustomActionTextAttachmentNode extends Fi {
7655
7652
  createDOM() {
7656
7653
  const figure = createElement(this.tagName, { "content-type": this.contentType, "data-lexxy-decorator": true });
7657
7654
 
7658
- figure.insertAdjacentHTML("beforeend", sanitizeAttachmentContent(this.innerHtml));
7655
+ figure.insertAdjacentHTML("beforeend", sanitize(this.innerHtml));
7659
7656
 
7660
7657
  const deleteButton = createElement("lexxy-node-delete-button");
7661
7658
  figure.appendChild(deleteButton);
@@ -13185,7 +13182,7 @@ class LexicalEditorElement extends HTMLElement {
13185
13182
  get value() {
13186
13183
  if (!this.cachedValue) {
13187
13184
  this.editor?.getEditorState().read(() => {
13188
- this.cachedValue = sanitize(g(this.editor, null), this.#allowedElements);
13185
+ this.cachedValue = sanitize(g(this.editor, null));
13189
13186
  });
13190
13187
  }
13191
13188
 
@@ -13244,6 +13241,7 @@ class LexicalEditorElement extends HTMLElement {
13244
13241
  this.#registerFocusEvents();
13245
13242
  this.#attachDebugHooks();
13246
13243
  this.#attachToolbar();
13244
+ this.#configureSanitizer();
13247
13245
  this.#loadInitialValue();
13248
13246
  this.#resetBeforeTurboCaches();
13249
13247
  }
@@ -13520,6 +13518,10 @@ class LexicalEditorElement extends HTMLElement {
13520
13518
  }
13521
13519
  }
13522
13520
 
13521
+ #configureSanitizer() {
13522
+ setSanitizerConfig(this.#allowedElements);
13523
+ }
13524
+
13523
13525
  get #allowedElements() {
13524
13526
  return this.#importableTags.concat(this.extensions.allowedElements)
13525
13527
  }
Binary file
Binary file