@37signals/lexxy 0.9.15-alpha.2 → 0.9.15-alpha.3

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.
Files changed (2) hide show
  1. package/dist/lexxy.esm.js +18 -4
  2. package/package.json +1 -1
package/dist/lexxy.esm.js CHANGED
@@ -5,7 +5,7 @@ import { SKIP_DOM_SELECTION_TAG, CAN_UNDO_COMMAND, COMMAND_PRIORITY_LOW, CAN_RED
5
5
  import { LinkNode, $createAutoLinkNode, $toggleLink, $createLinkNode, $isLinkNode, AutoLinkNode } from '@lexical/link';
6
6
  import { buildEditorFromExtensions } from '@lexical/extension';
7
7
  import { ListNode, ListItemNode, $getListDepth, INSERT_UNORDERED_LIST_COMMAND, INSERT_ORDERED_LIST_COMMAND, $isListItemNode, $isListNode, registerList } from '@lexical/list';
8
- import { $getNearestNodeOfType, $wrapNodeInElement, $lastToFirstIterator, $descendantsMatching, mergeRegister, $insertFirst, $unwrapAndFilterDescendants, $firstToLastIterator, $getNearestBlockElementAncestorOrThrow, IS_APPLE } from '@lexical/utils';
8
+ import { $getNearestNodeOfType, $wrapNodeInElement, $lastToFirstIterator, $descendantsMatching, mergeRegister, $insertNodeToNearestRoot, $insertFirst, $unwrapAndFilterDescendants, $firstToLastIterator, $getNearestBlockElementAncestorOrThrow, IS_APPLE } from '@lexical/utils';
9
9
  import { registerPlainText } from '@lexical/plain-text';
10
10
  import { RichTextExtension, $isQuoteNode, $isHeadingNode, $createHeadingNode, $createQuoteNode, QuoteNode, HeadingNode, registerRichText } from '@lexical/rich-text';
11
11
  import { $generateNodesFromDOM, $generateHtmlFromNodes } from '@lexical/html';
@@ -2308,6 +2308,13 @@ class ActionTextAttachmentNode extends DecoratorNode {
2308
2308
  if (!this.editor.read(() => this.isAttached())) return
2309
2309
  this.#swapToPreviewDOM(figure, this.src);
2310
2310
  };
2311
+ img.onerror = () => {
2312
+ // Clear pendingPreview so undo/redo or any JSON round-trip doesn't
2313
+ // re-enter the pending flow and issue another fetch. The file icon
2314
+ // stays as the stable fallback.
2315
+ if (!this.editor.read(() => this.isAttached())) return
2316
+ this.patchAndRewriteHistory({ pendingPreview: false });
2317
+ };
2311
2318
  img.src = this.src;
2312
2319
  }
2313
2320
 
@@ -3653,8 +3660,7 @@ class CommandDispatcher {
3653
3660
  }
3654
3661
 
3655
3662
  dispatchInsertHorizontalDivider() {
3656
- this.contents.insertAtCursorEnsuringLineBelow(new HorizontalDividerNode());
3657
- this.editor.focus();
3663
+ $insertNodeToNearestRoot(new HorizontalDividerNode);
3658
3664
  }
3659
3665
 
3660
3666
  dispatchSetFormatHeadingLarge() {
@@ -8667,6 +8673,10 @@ class LexicalPromptElement extends HTMLElement {
8667
8673
  return this.getAttribute("only-at")
8668
8674
  }
8669
8675
 
8676
+ get verticalDirection() {
8677
+ return this.getAttribute("vertical-direction")
8678
+ }
8679
+
8670
8680
  get open() {
8671
8681
  return this.popoverElement?.classList?.contains("lexxy-prompt-menu--visible")
8672
8682
  }
@@ -8899,7 +8909,11 @@ class LexicalPromptElement extends HTMLElement {
8899
8909
  this.popoverElement.toggleAttribute("data-clipped-at-right", true);
8900
8910
  }
8901
8911
 
8902
- if (popoverRect.bottom > window.innerHeight) {
8912
+ const forceTop = this.verticalDirection === "top";
8913
+ const forceBottom = this.verticalDirection === "bottom";
8914
+ const overflowsWindow = popoverRect.bottom > window.innerHeight;
8915
+
8916
+ if (!forceBottom && (forceTop || overflowsWindow)) {
8903
8917
  this.#setPopoverOffsetY(contentRect.height - y + fontSize);
8904
8918
  this.popoverElement.toggleAttribute("data-clipped-at-bottom", true);
8905
8919
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@37signals/lexxy",
3
- "version": "0.9.15-alpha.2",
3
+ "version": "0.9.15-alpha.3",
4
4
  "description": "Lexxy - A modern rich text editor for Rails.",
5
5
  "module": "dist/lexxy.esm.js",
6
6
  "type": "module",