alinea 2.0.0-preview.1 → 2.0.0-preview.2
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/.init/content/pages/welcome.json +1 -1
- package/dist/LICENSES.md +61 -34
- package/dist/adapter/next/DevRemote.d.ts +3 -0
- package/dist/adapter/next/DevRemote.js +37 -0
- package/dist/adapter/next/ForwardCredentials.d.ts +1 -0
- package/dist/adapter/next/ForwardCredentials.js +17 -0
- package/dist/adapter/next/cms.js +86 -38
- package/dist/adapter/next/context.d.ts +1 -1
- package/dist/adapter/next/context.js +11 -3
- package/dist/adapter/next/handler.d.ts +2 -0
- package/dist/adapter/next/handler.js +23 -16
- package/dist/adapter/next/with-alinea.js +18 -16
- package/dist/backend/Handler.d.ts +14 -13
- package/dist/backend/Handler.js +53 -22
- package/dist/backend/resolver/ParsePreview.d.ts +8 -4
- package/dist/backend/resolver/ParsePreview.js +40 -43
- package/dist/bundled.d.ts +255 -60
- package/dist/chunks/{chunk-LUBOGJCG.js → chunk-6V4TAD2N.js} +1 -1
- package/dist/chunks/{chunk-TL7ZW6BX.js → chunk-A3XXZBOQ.js} +2535 -2999
- package/dist/chunks/chunk-AC5ATYI3.js +1434 -0
- package/dist/chunks/{chunk-7ORQ7BYK.js → chunk-KMLLLZ6X.js} +202 -269
- package/dist/chunks/{chunk-IWN3T3FL.js → chunk-O7XWTMCB.js} +1 -1
- package/dist/chunks/{chunk-53DZYORR.js → chunk-PAYSVIYI.js} +76 -176
- package/dist/chunks/{chunk-YK3OSMDM.js → chunk-S4AU6SRS.js} +188 -158
- package/dist/chunks/{chunk-FRYHNUEK.js → chunk-UVOEM4AH.js} +6 -3
- package/dist/chunks/{chunk-I7X64JTZ.js → chunk-VXZM6V4P.js} +4 -4
- package/dist/cli/Generate.js +3 -13
- package/dist/cli/Serve.js +7 -3
- package/dist/cli/bin.js +8 -5
- package/dist/cli/generate/CopyStaticFiles.js +2 -3
- package/dist/cli/generate/DevDB.d.ts +1 -1
- package/dist/cli/generate/DevDB.js +3 -5
- package/dist/cli/serve/CreateLocalServer.d.ts +1 -1
- package/dist/cli/serve/CreateLocalServer.js +3 -2
- package/dist/cli/serve/DevServer.d.ts +3 -2
- package/dist/cli/serve/DevServer.js +60 -3
- package/dist/cli/serve/ServeContext.d.ts +1 -0
- package/dist/cli/serve/StartServer.d.ts +1 -0
- package/dist/cli/serve/StartServer.js +6 -1
- package/dist/cli/util/EnsureLibs.js +2 -2
- package/dist/cli/util/EnsureNode.js +2 -2
- package/dist/cloud/CloudRemote.js +1 -1
- package/dist/components/Breadcrumbs.js +8 -8
- package/dist/components/Button.js +6 -6
- package/dist/components/Calendar.js +9 -9
- package/dist/components/Checkbox.js +9 -9
- package/dist/components/CheckboxGroup.js +6 -6
- package/dist/components/ColorSwatch.js +6 -6
- package/dist/components/ColorSwatchPicker.js +6 -6
- package/dist/components/ComboBox.js +16 -16
- package/dist/components/DateField.js +9 -9
- package/dist/components/DatePicker.js +11 -11
- package/dist/components/DateRangePicker.js +14 -14
- package/dist/components/Dialog.js +6 -6
- package/dist/components/Disclosure.js +14 -14
- package/dist/components/DropZone.js +6 -6
- package/dist/components/Label.js +14 -14
- package/dist/components/Link.js +6 -6
- package/dist/components/List.js +32 -32
- package/dist/components/Menu.js +10 -10
- package/dist/components/Modal.js +8 -8
- package/dist/components/MultipleSelect.js +25 -25
- package/dist/components/NumberField.d.ts +2 -1
- package/dist/components/NumberField.js +25 -15
- package/dist/components/Popover.js +6 -6
- package/dist/components/ProgressCircle.js +9 -9
- package/dist/components/RadioGroup.js +8 -8
- package/dist/components/SearchField.js +15 -15
- package/dist/components/Select.js +14 -14
- package/dist/components/Surface.js +2 -2
- package/dist/components/Switch.js +8 -8
- package/dist/components/Table.js +14 -14
- package/dist/components/Tabs.js +7 -7
- package/dist/components/TagGroup.js +8 -8
- package/dist/components/TextField.js +10 -10
- package/dist/components/TimeField.js +8 -8
- package/dist/components/Toggle.js +8 -8
- package/dist/components/Toolbar.js +9 -9
- package/dist/components/Tooltip.js +7 -7
- package/dist/components/Tree.js +10 -10
- package/dist/core/Client.js +3 -2
- package/dist/core/Config.d.ts +4 -0
- package/dist/core/Config.js +6 -0
- package/dist/core/Connection.d.ts +2 -2
- package/dist/core/Connection.js +7 -0
- package/dist/core/Graph.d.ts +3 -4
- package/dist/core/ListRow.d.ts +2 -0
- package/dist/core/OrderBy.d.ts +7 -3
- package/dist/core/TextDoc.d.ts +11 -0
- package/dist/core/Trace.d.ts +8 -0
- package/dist/core/Trace.js +32 -0
- package/dist/core/db/CommitRequest.d.ts +0 -3
- package/dist/core/db/CommitRequest.js +0 -9
- package/dist/core/db/EntryDB.js +1 -1
- package/dist/core/db/EntryIndex.d.ts +10 -0
- package/dist/core/db/EntryIndex.js +117 -9
- package/dist/core/db/EntryResolver.js +104 -29
- package/dist/core/db/EntryTransaction.d.ts +1 -2
- package/dist/core/db/EntryTransaction.js +25 -13
- package/dist/core/db/LocalDB.d.ts +2 -3
- package/dist/core/db/LocalDB.js +24 -19
- package/dist/core/field/RichTextField.d.ts +30 -3
- package/dist/core/field/RichTextField.js +125 -41
- package/dist/core/media/MediaAltField.d.ts +1 -0
- package/dist/core/media/MediaAltField.js +9 -1
- package/dist/core/source/OverlaySource.d.ts +12 -0
- package/dist/core/source/OverlaySource.js +50 -0
- package/dist/core/source/Source.d.ts +1 -1
- package/dist/core/source/Source.js +3 -3
- package/dist/dashboard/App.css +158 -0
- package/dist/dashboard/App.js +3 -3
- package/dist/dashboard/app/AccessDenied.js +1 -1
- package/dist/dashboard/app/ActivityStatus.js +14 -14
- package/dist/dashboard/app/AppShell.js +2 -2
- package/dist/dashboard/app/AuthView.js +12 -12
- package/dist/dashboard/app/Badge.js +2 -2
- package/dist/dashboard/app/CompactField.js +13 -13
- package/dist/dashboard/app/DashboardErrorBoundary.js +6 -6
- package/dist/dashboard/app/DashboardLayout.js +22 -19
- package/dist/dashboard/app/EntryHeader.js +10 -10
- package/dist/dashboard/app/EntryReferences.js +9 -9
- package/dist/dashboard/app/EntrySidebar.d.ts +1 -1
- package/dist/dashboard/app/EntrySidebar.js +19 -18
- package/dist/dashboard/app/EntrySidebarPreview.d.ts +1 -1
- package/dist/dashboard/app/EntrySidebarPreview.js +20 -15
- package/dist/dashboard/app/EntryTranslationBanner.js +6 -6
- package/dist/dashboard/app/Explorer.js +46 -46
- package/dist/dashboard/app/ExplorerCards.js +42 -42
- package/dist/dashboard/app/ExplorerFileCard.js +16 -16
- package/dist/dashboard/app/ExplorerList.js +15 -15
- package/dist/dashboard/app/ExplorerModal.js +5 -5
- package/dist/dashboard/app/ExplorerTable.js +54 -54
- package/dist/dashboard/app/ExternalLinkPicker.js +15 -4
- package/dist/dashboard/app/LinkPicker.js +6 -6
- package/dist/dashboard/app/LocaleMenu.js +11 -11
- package/dist/dashboard/app/SidebarLayout.d.ts +8 -0
- package/dist/dashboard/app/SidebarLayout.js +1169 -0
- package/dist/dashboard/app/SidebarTree.js +44 -44
- package/dist/dashboard/app/WorkspaceMenu.js +17 -17
- package/dist/dashboard/app/WorkspaceRoots.js +26 -26
- package/dist/dashboard/app/editor/FileEditor.js +28 -29
- package/dist/dashboard/app/editor/FilePreview.js +2 -2
- package/dist/dashboard/app/editor/MediaAltField.view.d.ts +1 -1
- package/dist/dashboard/app/editor/MediaAltField.view.js +6 -9
- package/dist/dashboard/app/modals/CreateEntry.js +4 -4
- package/dist/dashboard/app/pages/EntryPage.js +49 -25
- package/dist/dashboard/app/pages/UsersPage.js +38 -38
- package/dist/dashboard/app/ui/DashboardModal.js +22 -22
- package/dist/dashboard/app/ui/Rail.js +2 -2
- package/dist/dashboard/app/ui/Sidebar.js +2 -2
- package/dist/dashboard/atoms/auth.js +2 -0
- package/dist/dashboard/atoms/dashboard.d.ts +9 -0
- package/dist/dashboard/atoms/dashboard.js +17 -0
- package/dist/dashboard/atoms/editor.d.ts +7 -1
- package/dist/dashboard/atoms/editor.js +4 -1
- package/dist/dashboard/atoms/entry.d.ts +3 -1
- package/dist/dashboard/atoms/entry.js +55 -15
- package/dist/dashboard/atoms/explorer.js +3 -8
- package/dist/dashboard/atoms/preview.d.ts +3 -0
- package/dist/dashboard/atoms/preview.js +18 -1
- package/dist/dashboard/hooks.d.ts +4 -2
- package/dist/dashboard/hooks.js +9 -5
- package/dist/dashboard/icons.d.ts +1 -0
- package/dist/dashboard/icons.js +10 -0
- package/dist/field/check/CheckField.view.js +2 -2
- package/dist/field/code/CodeField.view.js +13 -13
- package/dist/field/date/DateField.view.js +12 -2
- package/dist/field/link/Link.js +2 -2
- package/dist/field/link/LinkField.view.js +88 -77
- package/dist/field/list/ListField.view.js +22 -33
- package/dist/field/metadata/MetadataField.view.js +20 -20
- package/dist/field/number/NumberField.d.ts +2 -0
- package/dist/field/number/NumberField.view.js +4 -2
- package/dist/field/richtext/PickTextLink.d.ts +7 -0
- package/dist/field/richtext/PickTextLink.js +104 -2
- package/dist/field/richtext/ReferenceLink.d.ts +4 -1
- package/dist/field/richtext/ReferenceLink.js +18 -4
- package/dist/field/richtext/RichTextDocument.d.ts +7 -2
- package/dist/field/richtext/RichTextDocument.js +34 -5
- package/dist/field/richtext/RichTextExtensions.d.ts +3 -1
- package/dist/field/richtext/RichTextExtensions.js +2704 -7467
- package/dist/field/richtext/RichTextField.d.ts +4 -0
- package/dist/field/richtext/RichTextField.story.d.ts +4 -0
- package/dist/field/richtext/RichTextField.view.js +44 -21
- package/dist/field/richtext/RichTextInsertMenu.js +281 -495
- package/dist/field/richtext/RichTextToolbar.d.ts +5 -2
- package/dist/field/richtext/RichTextToolbar.js +38 -3
- package/dist/field/richtext/Toolbar.d.ts +19 -1
- package/dist/field/richtext/Toolbar.js +18 -13
- package/dist/field/richtext/extensions/Anchor.js +1 -1
- package/dist/field/richtext/extensions/Link.js +1 -1
- package/dist/field/richtext/extensions/Small.js +1 -1
- package/dist/field/select/SelectField.view.js +8 -6
- package/dist/index.css +219 -14
- package/dist/next.cjs +18 -16
- package/dist/next.d.ts +2 -1
- package/dist/next.edge.d.ts +2 -1
- package/dist/ui/RichText.d.ts +1 -0
- package/dist/ui/RichText.js +29 -2
- package/package.json +6 -3
- package/dist/chunks/{chunk-JFROOUG6.js → chunk-NIVGVRDS.js} +17 -17
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
$d447af545b77c9f1$export$b204af158042fbac,
|
|
72
72
|
$d447af545b77c9f1$export$f21a1ffae260145a,
|
|
73
73
|
$fe16bffc7a557bf0$export$7f54fc3180508a52
|
|
74
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-S4AU6SRS.js";
|
|
75
75
|
import {
|
|
76
76
|
__toESM
|
|
77
77
|
} from "./chunk-CQ52GEHY.js";
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
getTextSerializersFromSchema,
|
|
16
16
|
keydownHandler,
|
|
17
17
|
posToDOMRect
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-A3XXZBOQ.js";
|
|
19
19
|
|
|
20
20
|
// node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
|
|
21
21
|
var sides = ["top", "right", "bottom", "left"];
|
|
@@ -1600,17 +1600,23 @@ var computePosition2 = (reference, floating, options) => {
|
|
|
1600
1600
|
|
|
1601
1601
|
// node_modules/@tiptap/extension-floating-menu/dist/index.js
|
|
1602
1602
|
var FloatingMenuView = class {
|
|
1603
|
-
|
|
1604
|
-
editor
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1603
|
+
getTextContent(node) {
|
|
1604
|
+
return getText(node, { textSerializers: getTextSerializersFromSchema(this.editor.schema) });
|
|
1605
|
+
}
|
|
1606
|
+
get middlewares() {
|
|
1607
|
+
const middlewares = [];
|
|
1608
|
+
if (this.floatingUIOptions.flip) middlewares.push(flip2(typeof this.floatingUIOptions.flip !== "boolean" ? this.floatingUIOptions.flip : void 0));
|
|
1609
|
+
if (this.floatingUIOptions.shift) middlewares.push(shift2(typeof this.floatingUIOptions.shift !== "boolean" ? this.floatingUIOptions.shift : void 0));
|
|
1610
|
+
if (this.floatingUIOptions.offset) middlewares.push(offset2(typeof this.floatingUIOptions.offset !== "boolean" ? this.floatingUIOptions.offset : void 0));
|
|
1611
|
+
if (this.floatingUIOptions.arrow) middlewares.push(arrow2(this.floatingUIOptions.arrow));
|
|
1612
|
+
if (this.floatingUIOptions.size) middlewares.push(size2(typeof this.floatingUIOptions.size !== "boolean" ? this.floatingUIOptions.size : void 0));
|
|
1613
|
+
if (this.floatingUIOptions.autoPlacement) middlewares.push(autoPlacement2(typeof this.floatingUIOptions.autoPlacement !== "boolean" ? this.floatingUIOptions.autoPlacement : void 0));
|
|
1614
|
+
if (this.floatingUIOptions.hide) middlewares.push(hide2(typeof this.floatingUIOptions.hide !== "boolean" ? this.floatingUIOptions.hide : void 0));
|
|
1615
|
+
if (this.floatingUIOptions.inline) middlewares.push(inline2(typeof this.floatingUIOptions.inline !== "boolean" ? this.floatingUIOptions.inline : void 0));
|
|
1616
|
+
return middlewares;
|
|
1617
|
+
}
|
|
1618
|
+
constructor({ editor, element, view, pluginKey = "floatingMenu", updateDelay = 250, resizeDelay = 60, options, appendTo, shouldShow }) {
|
|
1619
|
+
var _options$scrollTarget;
|
|
1614
1620
|
this.preventHide = false;
|
|
1615
1621
|
this.isVisible = false;
|
|
1616
1622
|
this.scrollTarget = window;
|
|
@@ -1619,9 +1625,7 @@ var FloatingMenuView = class {
|
|
|
1619
1625
|
const { $anchor, empty } = selection;
|
|
1620
1626
|
const isRootDepth = $anchor.depth === 1;
|
|
1621
1627
|
const isEmptyTextBlock = $anchor.parent.isTextblock && !$anchor.parent.type.spec.code && !$anchor.parent.textContent && $anchor.parent.childCount === 0 && !this.getTextContent($anchor.parent);
|
|
1622
|
-
if (!view2.hasFocus() || !empty || !isRootDepth || !isEmptyTextBlock || !this.editor.isEditable)
|
|
1623
|
-
return false;
|
|
1624
|
-
}
|
|
1628
|
+
if (!view2.hasFocus() || !empty || !isRootDepth || !isEmptyTextBlock || !this.editor.isEditable) return false;
|
|
1625
1629
|
return true;
|
|
1626
1630
|
};
|
|
1627
1631
|
this.floatingUIOptions = {
|
|
@@ -1638,12 +1642,8 @@ var FloatingMenuView = class {
|
|
|
1638
1642
|
};
|
|
1639
1643
|
this.updateHandler = (view2, selectionChanged, docChanged, oldState) => {
|
|
1640
1644
|
const { composing } = view2;
|
|
1641
|
-
|
|
1642
|
-
if (
|
|
1643
|
-
return;
|
|
1644
|
-
}
|
|
1645
|
-
const shouldShow2 = this.getShouldShow(oldState);
|
|
1646
|
-
if (!shouldShow2) {
|
|
1645
|
+
if (composing || !selectionChanged && !docChanged) return;
|
|
1646
|
+
if (!this.getShouldShow(oldState)) {
|
|
1647
1647
|
this.hide();
|
|
1648
1648
|
return;
|
|
1649
1649
|
}
|
|
@@ -1657,41 +1657,31 @@ var FloatingMenuView = class {
|
|
|
1657
1657
|
setTimeout(() => this.update(this.editor.view));
|
|
1658
1658
|
};
|
|
1659
1659
|
this.blurHandler = ({ event }) => {
|
|
1660
|
-
var
|
|
1660
|
+
var _this$element$parentN;
|
|
1661
1661
|
if (this.preventHide) {
|
|
1662
1662
|
this.preventHide = false;
|
|
1663
1663
|
return;
|
|
1664
1664
|
}
|
|
1665
|
-
if ((event
|
|
1666
|
-
|
|
1667
|
-
}
|
|
1668
|
-
if ((event == null ? void 0 : event.relatedTarget) === this.editor.view.dom) {
|
|
1669
|
-
return;
|
|
1670
|
-
}
|
|
1665
|
+
if ((event === null || event === void 0 ? void 0 : event.relatedTarget) && ((_this$element$parentN = this.element.parentNode) === null || _this$element$parentN === void 0 ? void 0 : _this$element$parentN.contains(event.relatedTarget))) return;
|
|
1666
|
+
if ((event === null || event === void 0 ? void 0 : event.relatedTarget) === this.editor.view.dom) return;
|
|
1671
1667
|
this.hide();
|
|
1672
1668
|
};
|
|
1673
1669
|
this.transactionHandler = ({ transaction: tr }) => {
|
|
1674
1670
|
const meta = tr.getMeta(this.pluginKey);
|
|
1675
|
-
if (meta === "updatePosition")
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
} else if (meta === "hide") {
|
|
1680
|
-
this.hide();
|
|
1681
|
-
} else if (meta === "show") {
|
|
1671
|
+
if (meta === "updatePosition") this.updatePosition();
|
|
1672
|
+
else if (meta && typeof meta === "object" && meta.type === "updateOptions") this.updateOptions(meta.options);
|
|
1673
|
+
else if (meta === "hide") this.hide();
|
|
1674
|
+
else if (meta === "show") {
|
|
1682
1675
|
this.updatePosition();
|
|
1683
1676
|
this.show();
|
|
1684
1677
|
}
|
|
1685
1678
|
};
|
|
1686
1679
|
this.resizeHandler = () => {
|
|
1687
|
-
if (this.resizeDebounceTimer)
|
|
1688
|
-
clearTimeout(this.resizeDebounceTimer);
|
|
1689
|
-
}
|
|
1680
|
+
if (this.resizeDebounceTimer) clearTimeout(this.resizeDebounceTimer);
|
|
1690
1681
|
this.resizeDebounceTimer = window.setTimeout(() => {
|
|
1691
1682
|
this.updatePosition();
|
|
1692
1683
|
}, this.resizeDelay);
|
|
1693
1684
|
};
|
|
1694
|
-
var _a;
|
|
1695
1685
|
this.editor = editor;
|
|
1696
1686
|
this.element = element;
|
|
1697
1687
|
this.view = view;
|
|
@@ -1699,15 +1689,13 @@ var FloatingMenuView = class {
|
|
|
1699
1689
|
this.updateDelay = updateDelay;
|
|
1700
1690
|
this.resizeDelay = resizeDelay;
|
|
1701
1691
|
this.appendTo = appendTo;
|
|
1702
|
-
this.scrollTarget = (
|
|
1692
|
+
this.scrollTarget = (_options$scrollTarget = options === null || options === void 0 ? void 0 : options.scrollTarget) !== null && _options$scrollTarget !== void 0 ? _options$scrollTarget : window;
|
|
1703
1693
|
this.floatingUIOptions = {
|
|
1704
1694
|
...this.floatingUIOptions,
|
|
1705
1695
|
...options
|
|
1706
1696
|
};
|
|
1707
1697
|
this.element.tabIndex = 0;
|
|
1708
|
-
if (shouldShow)
|
|
1709
|
-
this.shouldShow = shouldShow;
|
|
1710
|
-
}
|
|
1698
|
+
if (shouldShow) this.shouldShow = shouldShow;
|
|
1711
1699
|
this.element.addEventListener("mousedown", this.mousedownHandler, { capture: true });
|
|
1712
1700
|
this.editor.on("focus", this.focusHandler);
|
|
1713
1701
|
this.editor.on("blur", this.blurHandler);
|
|
@@ -1720,73 +1708,14 @@ var FloatingMenuView = class {
|
|
|
1720
1708
|
this.updatePosition();
|
|
1721
1709
|
}
|
|
1722
1710
|
}
|
|
1723
|
-
getTextContent(node) {
|
|
1724
|
-
return getText(node, { textSerializers: getTextSerializersFromSchema(this.editor.schema) });
|
|
1725
|
-
}
|
|
1726
|
-
get middlewares() {
|
|
1727
|
-
const middlewares = [];
|
|
1728
|
-
if (this.floatingUIOptions.flip) {
|
|
1729
|
-
middlewares.push(
|
|
1730
|
-
flip2(
|
|
1731
|
-
typeof this.floatingUIOptions.flip !== "boolean" ? this.floatingUIOptions.flip : void 0
|
|
1732
|
-
)
|
|
1733
|
-
);
|
|
1734
|
-
}
|
|
1735
|
-
if (this.floatingUIOptions.shift) {
|
|
1736
|
-
middlewares.push(
|
|
1737
|
-
shift2(
|
|
1738
|
-
typeof this.floatingUIOptions.shift !== "boolean" ? this.floatingUIOptions.shift : void 0
|
|
1739
|
-
)
|
|
1740
|
-
);
|
|
1741
|
-
}
|
|
1742
|
-
if (this.floatingUIOptions.offset) {
|
|
1743
|
-
middlewares.push(
|
|
1744
|
-
offset2(
|
|
1745
|
-
typeof this.floatingUIOptions.offset !== "boolean" ? this.floatingUIOptions.offset : void 0
|
|
1746
|
-
)
|
|
1747
|
-
);
|
|
1748
|
-
}
|
|
1749
|
-
if (this.floatingUIOptions.arrow) {
|
|
1750
|
-
middlewares.push(arrow2(this.floatingUIOptions.arrow));
|
|
1751
|
-
}
|
|
1752
|
-
if (this.floatingUIOptions.size) {
|
|
1753
|
-
middlewares.push(
|
|
1754
|
-
size2(
|
|
1755
|
-
typeof this.floatingUIOptions.size !== "boolean" ? this.floatingUIOptions.size : void 0
|
|
1756
|
-
)
|
|
1757
|
-
);
|
|
1758
|
-
}
|
|
1759
|
-
if (this.floatingUIOptions.autoPlacement) {
|
|
1760
|
-
middlewares.push(
|
|
1761
|
-
autoPlacement2(
|
|
1762
|
-
typeof this.floatingUIOptions.autoPlacement !== "boolean" ? this.floatingUIOptions.autoPlacement : void 0
|
|
1763
|
-
)
|
|
1764
|
-
);
|
|
1765
|
-
}
|
|
1766
|
-
if (this.floatingUIOptions.hide) {
|
|
1767
|
-
middlewares.push(
|
|
1768
|
-
hide2(
|
|
1769
|
-
typeof this.floatingUIOptions.hide !== "boolean" ? this.floatingUIOptions.hide : void 0
|
|
1770
|
-
)
|
|
1771
|
-
);
|
|
1772
|
-
}
|
|
1773
|
-
if (this.floatingUIOptions.inline) {
|
|
1774
|
-
middlewares.push(
|
|
1775
|
-
inline2(
|
|
1776
|
-
typeof this.floatingUIOptions.inline !== "boolean" ? this.floatingUIOptions.inline : void 0
|
|
1777
|
-
)
|
|
1778
|
-
);
|
|
1779
|
-
}
|
|
1780
|
-
return middlewares;
|
|
1781
|
-
}
|
|
1782
1711
|
getShouldShow(oldState) {
|
|
1783
|
-
var
|
|
1712
|
+
var _this$shouldShow;
|
|
1784
1713
|
const { state } = this.view;
|
|
1785
1714
|
const { selection } = state;
|
|
1786
1715
|
const { ranges } = selection;
|
|
1787
1716
|
const from = Math.min(...ranges.map((range) => range.$from.pos));
|
|
1788
1717
|
const to = Math.max(...ranges.map((range) => range.$to.pos));
|
|
1789
|
-
|
|
1718
|
+
return (_this$shouldShow = this.shouldShow) === null || _this$shouldShow === void 0 ? void 0 : _this$shouldShow.call(this, {
|
|
1790
1719
|
editor: this.editor,
|
|
1791
1720
|
view: this.view,
|
|
1792
1721
|
state,
|
|
@@ -1794,26 +1723,17 @@ var FloatingMenuView = class {
|
|
|
1794
1723
|
from,
|
|
1795
1724
|
to
|
|
1796
1725
|
});
|
|
1797
|
-
return shouldShow;
|
|
1798
1726
|
}
|
|
1799
1727
|
updateOptions(newProps) {
|
|
1800
|
-
|
|
1801
|
-
if (newProps.
|
|
1802
|
-
|
|
1803
|
-
}
|
|
1804
|
-
if (newProps.resizeDelay !== void 0) {
|
|
1805
|
-
this.resizeDelay = newProps.resizeDelay;
|
|
1806
|
-
}
|
|
1807
|
-
if (newProps.appendTo !== void 0) {
|
|
1808
|
-
this.appendTo = newProps.appendTo;
|
|
1809
|
-
}
|
|
1728
|
+
if (newProps.updateDelay !== void 0) this.updateDelay = newProps.updateDelay;
|
|
1729
|
+
if (newProps.resizeDelay !== void 0) this.resizeDelay = newProps.resizeDelay;
|
|
1730
|
+
if (newProps.appendTo !== void 0) this.appendTo = newProps.appendTo;
|
|
1810
1731
|
if (newProps.shouldShow !== void 0) {
|
|
1811
|
-
if (newProps.shouldShow)
|
|
1812
|
-
this.shouldShow = newProps.shouldShow;
|
|
1813
|
-
}
|
|
1732
|
+
if (newProps.shouldShow) this.shouldShow = newProps.shouldShow;
|
|
1814
1733
|
}
|
|
1815
1734
|
if (newProps.options !== void 0) {
|
|
1816
|
-
|
|
1735
|
+
var _newProps$options$scr;
|
|
1736
|
+
const newScrollTarget = (_newProps$options$scr = newProps.options.scrollTarget) !== null && _newProps$options$scr !== void 0 ? _newProps$options$scr : window;
|
|
1817
1737
|
if (newScrollTarget !== this.scrollTarget) {
|
|
1818
1738
|
this.scrollTarget.removeEventListener("scroll", this.resizeHandler);
|
|
1819
1739
|
this.scrollTarget = newScrollTarget;
|
|
@@ -1826,23 +1746,20 @@ var FloatingMenuView = class {
|
|
|
1826
1746
|
}
|
|
1827
1747
|
}
|
|
1828
1748
|
updatePosition() {
|
|
1829
|
-
var
|
|
1830
|
-
if (!((
|
|
1831
|
-
return;
|
|
1832
|
-
}
|
|
1749
|
+
var _this$view;
|
|
1750
|
+
if (!((_this$view = this.view) === null || _this$view === void 0 || (_this$view = _this$view.dom) === null || _this$view === void 0 ? void 0 : _this$view.parentNode)) return;
|
|
1833
1751
|
const { selection } = this.editor.state;
|
|
1834
1752
|
const domRect = posToDOMRect(this.view, selection.from, selection.to);
|
|
1835
|
-
|
|
1753
|
+
computePosition2({
|
|
1836
1754
|
getBoundingClientRect: () => domRect,
|
|
1837
1755
|
getClientRects: () => [domRect]
|
|
1838
|
-
}
|
|
1839
|
-
computePosition2(virtualElement, this.element, {
|
|
1756
|
+
}, this.element, {
|
|
1840
1757
|
placement: this.floatingUIOptions.placement,
|
|
1841
1758
|
strategy: this.floatingUIOptions.strategy,
|
|
1842
1759
|
middleware: this.middlewares
|
|
1843
1760
|
}).then(({ x, y, strategy, middlewareData }) => {
|
|
1844
|
-
var
|
|
1845
|
-
if (((
|
|
1761
|
+
var _middlewareData$hide, _middlewareData$hide2;
|
|
1762
|
+
if (((_middlewareData$hide = middlewareData.hide) === null || _middlewareData$hide === void 0 ? void 0 : _middlewareData$hide.referenceHidden) || ((_middlewareData$hide2 = middlewareData.hide) === null || _middlewareData$hide2 === void 0 ? void 0 : _middlewareData$hide2.escaped)) {
|
|
1846
1763
|
this.element.style.visibility = "hidden";
|
|
1847
1764
|
return;
|
|
1848
1765
|
}
|
|
@@ -1851,40 +1768,30 @@ var FloatingMenuView = class {
|
|
|
1851
1768
|
this.element.style.position = strategy;
|
|
1852
1769
|
this.element.style.left = `${x}px`;
|
|
1853
1770
|
this.element.style.top = `${y}px`;
|
|
1854
|
-
if (this.isVisible && this.floatingUIOptions.onUpdate)
|
|
1855
|
-
this.floatingUIOptions.onUpdate();
|
|
1856
|
-
}
|
|
1771
|
+
if (this.isVisible && this.floatingUIOptions.onUpdate) this.floatingUIOptions.onUpdate();
|
|
1857
1772
|
});
|
|
1858
1773
|
}
|
|
1859
1774
|
update(view, oldState) {
|
|
1860
|
-
const selectionChanged = !(oldState
|
|
1861
|
-
const docChanged = !(oldState
|
|
1775
|
+
const selectionChanged = !(oldState === null || oldState === void 0 ? void 0 : oldState.selection.eq(view.state.selection));
|
|
1776
|
+
const docChanged = !(oldState === null || oldState === void 0 ? void 0 : oldState.doc.eq(view.state.doc));
|
|
1862
1777
|
this.updateHandler(view, selectionChanged, docChanged, oldState);
|
|
1863
1778
|
}
|
|
1864
1779
|
show() {
|
|
1865
|
-
var
|
|
1866
|
-
if (this.isVisible)
|
|
1867
|
-
return;
|
|
1868
|
-
}
|
|
1780
|
+
var _ref;
|
|
1781
|
+
if (this.isVisible) return;
|
|
1869
1782
|
this.element.style.visibility = "visible";
|
|
1870
1783
|
this.element.style.opacity = "1";
|
|
1871
1784
|
const appendToElement = typeof this.appendTo === "function" ? this.appendTo() : this.appendTo;
|
|
1872
|
-
(
|
|
1873
|
-
if (this.floatingUIOptions.onShow)
|
|
1874
|
-
this.floatingUIOptions.onShow();
|
|
1875
|
-
}
|
|
1785
|
+
(_ref = appendToElement !== null && appendToElement !== void 0 ? appendToElement : this.view.dom.parentElement) === null || _ref === void 0 || _ref.appendChild(this.element);
|
|
1786
|
+
if (this.floatingUIOptions.onShow) this.floatingUIOptions.onShow();
|
|
1876
1787
|
this.isVisible = true;
|
|
1877
1788
|
}
|
|
1878
1789
|
hide() {
|
|
1879
|
-
if (!this.isVisible)
|
|
1880
|
-
return;
|
|
1881
|
-
}
|
|
1790
|
+
if (!this.isVisible) return;
|
|
1882
1791
|
this.element.style.visibility = "hidden";
|
|
1883
1792
|
this.element.style.opacity = "0";
|
|
1884
1793
|
this.element.remove();
|
|
1885
|
-
if (this.floatingUIOptions.onHide)
|
|
1886
|
-
this.floatingUIOptions.onHide();
|
|
1887
|
-
}
|
|
1794
|
+
if (this.floatingUIOptions.onHide) this.floatingUIOptions.onHide();
|
|
1888
1795
|
this.isVisible = false;
|
|
1889
1796
|
}
|
|
1890
1797
|
destroy() {
|
|
@@ -1895,15 +1802,16 @@ var FloatingMenuView = class {
|
|
|
1895
1802
|
this.editor.off("focus", this.focusHandler);
|
|
1896
1803
|
this.editor.off("blur", this.blurHandler);
|
|
1897
1804
|
this.editor.off("transaction", this.transactionHandler);
|
|
1898
|
-
if (this.floatingUIOptions.onDestroy)
|
|
1899
|
-
this.floatingUIOptions.onDestroy();
|
|
1900
|
-
}
|
|
1805
|
+
if (this.floatingUIOptions.onDestroy) this.floatingUIOptions.onDestroy();
|
|
1901
1806
|
}
|
|
1902
1807
|
};
|
|
1903
1808
|
var FloatingMenuPlugin = (options) => {
|
|
1904
1809
|
return new Plugin({
|
|
1905
1810
|
key: typeof options.pluginKey === "string" ? new PluginKey(options.pluginKey) : options.pluginKey,
|
|
1906
|
-
view: (view) => new FloatingMenuView({
|
|
1811
|
+
view: (view) => new FloatingMenuView({
|
|
1812
|
+
view,
|
|
1813
|
+
...options
|
|
1814
|
+
})
|
|
1907
1815
|
});
|
|
1908
1816
|
};
|
|
1909
1817
|
var FloatingMenu = Extension.create({
|
|
@@ -1920,34 +1828,26 @@ var FloatingMenu = Extension.create({
|
|
|
1920
1828
|
};
|
|
1921
1829
|
},
|
|
1922
1830
|
addCommands() {
|
|
1923
|
-
return {
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
}
|
|
1928
|
-
return true;
|
|
1929
|
-
}
|
|
1930
|
-
};
|
|
1831
|
+
return { updateFloatingMenuPosition: () => ({ tr, dispatch }) => {
|
|
1832
|
+
if (dispatch) tr.setMeta(this.options.pluginKey, "updatePosition");
|
|
1833
|
+
return true;
|
|
1834
|
+
} };
|
|
1931
1835
|
},
|
|
1932
1836
|
addProseMirrorPlugins() {
|
|
1933
|
-
if (!this.options.element)
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
appendTo: this.options.appendTo,
|
|
1945
|
-
shouldShow: this.options.shouldShow
|
|
1946
|
-
})
|
|
1947
|
-
];
|
|
1837
|
+
if (!this.options.element) return [];
|
|
1838
|
+
return [FloatingMenuPlugin({
|
|
1839
|
+
pluginKey: this.options.pluginKey,
|
|
1840
|
+
editor: this.editor,
|
|
1841
|
+
element: this.options.element,
|
|
1842
|
+
updateDelay: this.options.updateDelay,
|
|
1843
|
+
resizeDelay: this.options.resizeDelay,
|
|
1844
|
+
options: this.options.options,
|
|
1845
|
+
appendTo: this.options.appendTo,
|
|
1846
|
+
shouldShow: this.options.shouldShow
|
|
1847
|
+
})];
|
|
1948
1848
|
}
|
|
1949
1849
|
});
|
|
1950
|
-
var
|
|
1850
|
+
var src_default = FloatingMenu;
|
|
1951
1851
|
|
|
1952
1852
|
// node_modules/prosemirror-tables/dist/index.js
|
|
1953
1853
|
var readFromCache;
|
|
@@ -3684,7 +3584,7 @@ export {
|
|
|
3684
3584
|
inline2 as inline,
|
|
3685
3585
|
computePosition2 as computePosition,
|
|
3686
3586
|
FloatingMenuPlugin,
|
|
3687
|
-
|
|
3587
|
+
src_default,
|
|
3688
3588
|
CellSelection,
|
|
3689
3589
|
fixTables,
|
|
3690
3590
|
addColumnBefore,
|