@threadlabs/looma 0.28.22 → 0.29.1
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/components/ui-editor-code-language/ui-editor-code-language.html +1 -1
- package/components/ui-editor-image-toolbar/ui-editor-image-toolbar.html +1 -2
- package/components/ui-editor-link-form/ui-editor-link-form.html +2 -3
- package/components/ui-tooltip/ui-tooltip.html +5 -2
- package/dist/index.js +1 -1
- package/editor/image-uploads.d.ts +23 -15
- package/editor/link-editing.d.ts +4 -4
- package/editor/requests.d.ts +43 -0
- package/package.json +3 -3
- package/styles/ui-action-bar.css +1 -1
- package/styles/ui-affordance-scope.css +1 -1
- package/styles/ui-avatar-group.css +1 -1
- package/styles/ui-avatar.css +1 -1
- package/styles/ui-badge.css +1 -1
- package/styles/ui-breadcrumb-item.css +1 -1
- package/styles/ui-breadcrumbs.css +1 -1
- package/styles/ui-button.css +1 -1
- package/styles/ui-callout.css +1 -1
- package/styles/ui-card.css +1 -1
- package/styles/ui-checkbox.css +1 -1
- package/styles/ui-cluster.css +1 -1
- package/styles/ui-combobox.css +1 -1
- package/styles/ui-container.css +1 -1
- package/styles/ui-context-menu.css +1 -1
- package/styles/ui-cover.css +1 -1
- package/styles/ui-description-item.css +1 -1
- package/styles/ui-description-list.css +1 -1
- package/styles/ui-dialog.css +1 -1
- package/styles/ui-disclosure.css +1 -1
- package/styles/ui-editable.css +1 -1
- package/styles/ui-editor-block-actions.css +1 -1
- package/styles/ui-editor-chip-editor.css +1 -1
- package/styles/ui-editor-code-language.css +1 -1
- package/styles/ui-editor-image-toolbar.css +1 -1
- package/styles/ui-editor-insert-table-grid.css +1 -1
- package/styles/ui-editor-link-card.css +1 -1
- package/styles/ui-editor-link-form.css +1 -1
- package/styles/ui-editor-mention-menu-item.css +1 -1
- package/styles/ui-editor-mention-menu.css +1 -1
- package/styles/ui-editor-slash-menu-group.css +1 -1
- package/styles/ui-editor-slash-menu-item.css +1 -1
- package/styles/ui-editor-slash-menu.css +1 -1
- package/styles/ui-editor-surface.css +1 -1
- package/styles/ui-editor-table-context-menu.css +1 -1
- package/styles/ui-editor-table-overlay.css +1 -1
- package/styles/ui-editor-table-toolbar.css +1 -1
- package/styles/ui-editor-toolbar.css +1 -1
- package/styles/ui-floating-action-button.css +1 -1
- package/styles/ui-form-field.css +1 -1
- package/styles/ui-grid.css +1 -1
- package/styles/ui-icon-button.css +1 -1
- package/styles/ui-icon.css +1 -1
- package/styles/ui-image.css +1 -1
- package/styles/ui-input-group.css +1 -1
- package/styles/ui-input.css +1 -1
- package/styles/ui-list-item.css +1 -1
- package/styles/ui-list.css +1 -1
- package/styles/ui-listbox.css +1 -1
- package/styles/ui-menu-group.css +1 -1
- package/styles/ui-menu-item.css +1 -1
- package/styles/ui-menu.css +1 -1
- package/styles/ui-meter.css +1 -1
- package/styles/ui-nav-item.css +1 -1
- package/styles/ui-page-header.css +1 -1
- package/styles/ui-popover.css +1 -1
- package/styles/ui-radio-group.css +1 -1
- package/styles/ui-radio.css +1 -1
- package/styles/ui-reel.css +1 -1
- package/styles/ui-scroll-area.css +1 -1
- package/styles/ui-search-result-row.css +1 -1
- package/styles/ui-search-shell.css +1 -1
- package/styles/ui-section.css +1 -1
- package/styles/ui-select.css +1 -1
- package/styles/ui-separator.css +1 -1
- package/styles/ui-sidebar.css +1 -1
- package/styles/ui-spinner.css +1 -1
- package/styles/ui-stack.css +1 -1
- package/styles/ui-status-message.css +1 -1
- package/styles/ui-swatch.css +1 -1
- package/styles/ui-switch.css +1 -1
- package/styles/ui-switcher.css +1 -1
- package/styles/ui-table.css +1 -1
- package/styles/ui-tabs.css +1 -1
- package/styles/ui-text.css +1 -1
- package/styles/ui-textarea.css +1 -1
- package/styles/ui-toast-region.css +1 -1
- package/styles/ui-toast.css +1 -1
- package/styles/ui-tooltip.css +7 -2
- package/styles/ui-top-bar.css +1 -1
- package/styles/ui-tree-item.css +1 -1
- package/styles/ui-tree.css +1 -1
- package/vanilla/UiActionBar.d.ts +1 -1
- package/vanilla/UiActionBar.js +6 -6
- package/vanilla/UiAffordanceScope.d.ts +1 -1
- package/vanilla/UiAffordanceScope.js +1 -1
- package/vanilla/UiAvatar.d.ts +1 -1
- package/vanilla/UiAvatar.js +7 -7
- package/vanilla/UiAvatarGroup.d.ts +1 -1
- package/vanilla/UiAvatarGroup.js +4 -4
- package/vanilla/UiBadge.d.ts +1 -1
- package/vanilla/UiBadge.js +4 -4
- package/vanilla/UiBreadcrumbItem.d.ts +1 -1
- package/vanilla/UiBreadcrumbItem.js +3 -3
- package/vanilla/UiBreadcrumbs.d.ts +1 -1
- package/vanilla/UiBreadcrumbs.js +1 -1
- package/vanilla/UiButton.d.ts +1 -1
- package/vanilla/UiButton.js +17 -17
- package/vanilla/UiCallout.d.ts +1 -1
- package/vanilla/UiCallout.js +13 -13
- package/vanilla/UiCard.d.ts +1 -1
- package/vanilla/UiCard.js +1 -1
- package/vanilla/UiCheckbox.d.ts +1 -1
- package/vanilla/UiCheckbox.js +6 -6
- package/vanilla/UiCluster.d.ts +1 -1
- package/vanilla/UiCluster.js +1 -1
- package/vanilla/UiCombobox.d.ts +1 -1
- package/vanilla/UiCombobox.js +48 -48
- package/vanilla/UiContainer.d.ts +1 -1
- package/vanilla/UiContainer.js +1 -1
- package/vanilla/UiContextMenu.d.ts +1 -1
- package/vanilla/UiContextMenu.js +1 -1
- package/vanilla/UiCover.d.ts +1 -1
- package/vanilla/UiCover.js +1 -1
- package/vanilla/UiDescriptionItem.d.ts +1 -1
- package/vanilla/UiDescriptionItem.js +4 -4
- package/vanilla/UiDescriptionList.d.ts +1 -1
- package/vanilla/UiDescriptionList.js +1 -1
- package/vanilla/UiDialog.d.ts +1 -1
- package/vanilla/UiDialog.js +7 -7
- package/vanilla/UiDisclosure.d.ts +1 -1
- package/vanilla/UiDisclosure.js +8 -8
- package/vanilla/UiEditable.d.ts +1 -1
- package/vanilla/UiEditable.js +11 -11
- package/vanilla/UiEditorBlockActions.d.ts +1 -1
- package/vanilla/UiEditorBlockActions.js +3 -3
- package/vanilla/UiEditorChipEditor.d.ts +1 -1
- package/vanilla/UiEditorChipEditor.js +4 -4
- package/vanilla/UiEditorCodeLanguage.d.ts +1 -1
- package/vanilla/UiEditorCodeLanguage.js +7 -12
- package/vanilla/UiEditorImageToolbar.d.ts +1 -1
- package/vanilla/UiEditorImageToolbar.js +90 -95
- package/vanilla/UiEditorInsertTableGrid.d.ts +1 -1
- package/vanilla/UiEditorInsertTableGrid.js +7 -7
- package/vanilla/UiEditorLinkCard.d.ts +1 -1
- package/vanilla/UiEditorLinkCard.js +13 -13
- package/vanilla/UiEditorLinkForm.d.ts +1 -1
- package/vanilla/UiEditorLinkForm.js +32 -44
- package/vanilla/UiEditorMentionMenu.d.ts +1 -1
- package/vanilla/UiEditorMentionMenu.js +12 -12
- package/vanilla/UiEditorMentionMenuItem.d.ts +1 -1
- package/vanilla/UiEditorMentionMenuItem.js +4 -4
- package/vanilla/UiEditorSlashMenu.d.ts +1 -1
- package/vanilla/UiEditorSlashMenu.js +11 -11
- package/vanilla/UiEditorSlashMenuGroup.d.ts +1 -1
- package/vanilla/UiEditorSlashMenuGroup.js +5 -5
- package/vanilla/UiEditorSlashMenuItem.d.ts +1 -1
- package/vanilla/UiEditorSlashMenuItem.js +4 -4
- package/vanilla/UiEditorSurface.d.ts +1 -1
- package/vanilla/UiEditorSurface.js +1 -1
- package/vanilla/UiEditorTableContextMenu.d.ts +1 -1
- package/vanilla/UiEditorTableContextMenu.js +16 -16
- package/vanilla/UiEditorTableOverlay.d.ts +1 -1
- package/vanilla/UiEditorTableOverlay.js +18 -18
- package/vanilla/UiEditorTableToolbar.d.ts +1 -1
- package/vanilla/UiEditorTableToolbar.js +33 -33
- package/vanilla/UiEditorToolbar.d.ts +1 -1
- package/vanilla/UiEditorToolbar.js +1 -1
- package/vanilla/UiFloatingActionButton.d.ts +1 -1
- package/vanilla/UiFloatingActionButton.js +1 -1
- package/vanilla/UiFormField.d.ts +1 -1
- package/vanilla/UiFormField.js +8 -8
- package/vanilla/UiGrid.d.ts +1 -1
- package/vanilla/UiGrid.js +1 -1
- package/vanilla/UiIcon.d.ts +1 -1
- package/vanilla/UiIcon.js +4 -4
- package/vanilla/UiIconButton.d.ts +1 -1
- package/vanilla/UiIconButton.js +4 -4
- package/vanilla/UiImage.d.ts +1 -1
- package/vanilla/UiImage.js +6 -6
- package/vanilla/UiInput.d.ts +1 -1
- package/vanilla/UiInput.js +1 -1
- package/vanilla/UiInputGroup.d.ts +1 -1
- package/vanilla/UiInputGroup.js +6 -6
- package/vanilla/UiList.d.ts +1 -1
- package/vanilla/UiList.js +1 -1
- package/vanilla/UiListItem.d.ts +1 -1
- package/vanilla/UiListItem.js +7 -7
- package/vanilla/UiListbox.d.ts +1 -1
- package/vanilla/UiListbox.js +12 -12
- package/vanilla/UiMenu.d.ts +1 -1
- package/vanilla/UiMenu.js +1 -1
- package/vanilla/UiMenuGroup.d.ts +1 -1
- package/vanilla/UiMenuGroup.js +4 -4
- package/vanilla/UiMenuItem.d.ts +1 -1
- package/vanilla/UiMenuItem.js +11 -11
- package/vanilla/UiMeter.d.ts +1 -1
- package/vanilla/UiMeter.js +8 -8
- package/vanilla/UiNavItem.d.ts +1 -1
- package/vanilla/UiNavItem.js +13 -13
- package/vanilla/UiPageHeader.d.ts +1 -1
- package/vanilla/UiPageHeader.js +8 -8
- package/vanilla/UiPopover.d.ts +1 -1
- package/vanilla/UiPopover.js +1 -1
- package/vanilla/UiRadio.d.ts +1 -1
- package/vanilla/UiRadio.js +6 -6
- package/vanilla/UiRadioGroup.d.ts +1 -1
- package/vanilla/UiRadioGroup.js +4 -4
- package/vanilla/UiReel.d.ts +1 -1
- package/vanilla/UiReel.js +1 -1
- package/vanilla/UiScrollArea.d.ts +1 -1
- package/vanilla/UiScrollArea.js +1 -1
- package/vanilla/UiSearchResultRow.d.ts +1 -1
- package/vanilla/UiSearchResultRow.js +8 -8
- package/vanilla/UiSearchShell.d.ts +1 -1
- package/vanilla/UiSearchShell.js +8 -8
- package/vanilla/UiSection.d.ts +1 -1
- package/vanilla/UiSection.js +8 -8
- package/vanilla/UiSelect.d.ts +1 -1
- package/vanilla/UiSelect.js +1 -1
- package/vanilla/UiSeparator.d.ts +1 -1
- package/vanilla/UiSeparator.js +1 -1
- package/vanilla/UiSidebar.d.ts +1 -1
- package/vanilla/UiSidebar.js +4 -4
- package/vanilla/UiSpinner.d.ts +1 -1
- package/vanilla/UiSpinner.js +2 -2
- package/vanilla/UiStack.d.ts +1 -1
- package/vanilla/UiStack.js +1 -1
- package/vanilla/UiStatusMessage.d.ts +1 -1
- package/vanilla/UiStatusMessage.js +7 -7
- package/vanilla/UiSwatch.d.ts +1 -1
- package/vanilla/UiSwatch.js +1 -1
- package/vanilla/UiSwitch.d.ts +1 -1
- package/vanilla/UiSwitch.js +6 -6
- package/vanilla/UiSwitcher.d.ts +1 -1
- package/vanilla/UiSwitcher.js +1 -1
- package/vanilla/UiTable.d.ts +1 -1
- package/vanilla/UiTable.js +1 -1
- package/vanilla/UiTabs.d.ts +1 -1
- package/vanilla/UiTabs.js +7 -7
- package/vanilla/UiText.d.ts +1 -1
- package/vanilla/UiText.js +1 -1
- package/vanilla/UiTextarea.d.ts +1 -1
- package/vanilla/UiTextarea.js +1 -1
- package/vanilla/UiToast.d.ts +1 -1
- package/vanilla/UiToast.js +5 -5
- package/vanilla/UiToastRegion.d.ts +1 -1
- package/vanilla/UiToastRegion.js +8 -8
- package/vanilla/UiTooltip.d.ts +1 -1
- package/vanilla/UiTooltip.js +9 -8
- package/vanilla/UiTopBar.d.ts +1 -1
- package/vanilla/UiTopBar.js +6 -6
- package/vanilla/UiTree.d.ts +1 -1
- package/vanilla/UiTree.js +1 -1
- package/vanilla/UiTreeItem.d.ts +1 -1
- package/vanilla/UiTreeItem.js +13 -13
- package/vue/UiActionBar.vue +8 -5
- package/vue/UiAffordanceScope.vue +1 -1
- package/vue/UiAvatar.vue +10 -11
- package/vue/UiAvatarGroup.vue +2 -3
- package/vue/UiBadge.vue +5 -3
- package/vue/UiBreadcrumbItem.vue +2 -3
- package/vue/UiBreadcrumbs.vue +1 -1
- package/vue/UiButton.vue +15 -13
- package/vue/UiCallout.vue +8 -15
- package/vue/UiCard.vue +1 -1
- package/vue/UiCheckbox.vue +5 -4
- package/vue/UiCluster.vue +1 -1
- package/vue/UiCombobox.vue +25 -27
- package/vue/UiContainer.vue +1 -1
- package/vue/UiContextMenu.vue +1 -1
- package/vue/UiCover.vue +1 -1
- package/vue/UiDescriptionItem.vue +1 -1
- package/vue/UiDescriptionList.vue +1 -1
- package/vue/UiDialog.vue +4 -3
- package/vue/UiDisclosure.vue +9 -8
- package/vue/UiEditable.vue +13 -9
- package/vue/UiEditorBlockActions.vue +5 -4
- package/vue/UiEditorChipEditor.vue +7 -9
- package/vue/UiEditorCodeLanguage.vue +2 -2
- package/vue/UiEditorImageToolbar.vue +25 -32
- package/vue/UiEditorInsertTableGrid.vue +1 -1
- package/vue/UiEditorLinkCard.vue +17 -20
- package/vue/UiEditorLinkForm.vue +21 -23
- package/vue/UiEditorMentionMenu.vue +9 -7
- package/vue/UiEditorMentionMenuItem.vue +5 -6
- package/vue/UiEditorSlashMenu.vue +3 -5
- package/vue/UiEditorSlashMenuGroup.vue +1 -1
- package/vue/UiEditorSlashMenuItem.vue +5 -6
- package/vue/UiEditorSurface.vue +1 -1
- package/vue/UiEditorTableContextMenu.vue +4 -7
- package/vue/UiEditorTableOverlay.vue +26 -18
- package/vue/UiEditorTableToolbar.vue +23 -21
- package/vue/UiEditorToolbar.vue +1 -1
- package/vue/UiFloatingActionButton.vue +1 -1
- package/vue/UiFormField.vue +4 -3
- package/vue/UiGrid.vue +1 -1
- package/vue/UiIcon.vue +1 -1
- package/vue/UiIconButton.vue +4 -3
- package/vue/UiImage.vue +4 -7
- package/vue/UiInput.vue +1 -1
- package/vue/UiInputGroup.vue +7 -5
- package/vue/UiList.vue +1 -1
- package/vue/UiListItem.vue +10 -7
- package/vue/UiListbox.vue +3 -5
- package/vue/UiMenu.vue +1 -1
- package/vue/UiMenuGroup.vue +2 -3
- package/vue/UiMenuItem.vue +15 -10
- package/vue/UiMeter.vue +4 -5
- package/vue/UiNavItem.vue +19 -13
- package/vue/UiPageHeader.vue +8 -7
- package/vue/UiPopover.vue +1 -1
- package/vue/UiRadio.vue +10 -6
- package/vue/UiRadioGroup.vue +1 -1
- package/vue/UiReel.vue +1 -1
- package/vue/UiScrollArea.vue +1 -1
- package/vue/UiSearchResultRow.vue +11 -8
- package/vue/UiSearchShell.vue +1 -1
- package/vue/UiSection.vue +7 -4
- package/vue/UiSelect.vue +1 -1
- package/vue/UiSeparator.vue +1 -1
- package/vue/UiSidebar.vue +1 -1
- package/vue/UiSpinner.vue +1 -1
- package/vue/UiStack.vue +1 -1
- package/vue/UiStatusMessage.vue +10 -6
- package/vue/UiSwatch.vue +1 -1
- package/vue/UiSwitch.vue +10 -6
- package/vue/UiSwitcher.vue +1 -1
- package/vue/UiTable.vue +1 -1
- package/vue/UiTabs.vue +3 -3
- package/vue/UiText.vue +1 -1
- package/vue/UiTextarea.vue +1 -1
- package/vue/UiToast.vue +1 -1
- package/vue/UiToastRegion.vue +7 -5
- package/vue/UiTooltip.vue +10 -5
- package/vue/UiTopBar.vue +1 -1
- package/vue/UiTree.vue +1 -1
- package/vue/UiTreeItem.vue +14 -13
- package/vue/chunks/UiActionBar.js +4 -2
- package/vue/chunks/UiAffordanceScope.js +1 -1
- package/vue/chunks/UiAvatar.js +18 -12
- package/vue/chunks/UiAvatarGroup.js +15 -11
- package/vue/chunks/UiBadge.js +7 -3
- package/vue/chunks/UiBreadcrumbItem.js +10 -6
- package/vue/chunks/UiBreadcrumbs.js +1 -1
- package/vue/chunks/UiButton.js +10 -2
- package/vue/chunks/UiCallout.js +13 -3
- package/vue/chunks/UiCard.js +1 -1
- package/vue/chunks/UiCheckbox.js +35 -27
- package/vue/chunks/UiCluster.js +1 -1
- package/vue/chunks/UiCombobox.js +108 -74
- package/vue/chunks/UiContainer.js +1 -1
- package/vue/chunks/UiContextMenu.js +1 -1
- package/vue/chunks/UiCover.js +1 -1
- package/vue/chunks/UiDescriptionItem.js +1 -1
- package/vue/chunks/UiDescriptionList.js +1 -1
- package/vue/chunks/UiDialog.js +14 -10
- package/vue/chunks/UiDisclosure.js +3 -1
- package/vue/chunks/UiEditable.js +36 -24
- package/vue/chunks/UiEditorBlockActions.js +3 -1
- package/vue/chunks/UiEditorChipEditor.js +31 -22
- package/vue/chunks/UiEditorCodeLanguage.js +1 -1
- package/vue/chunks/UiEditorImageToolbar.js +45 -27
- package/vue/chunks/UiEditorInsertTableGrid.js +1 -1
- package/vue/chunks/UiEditorLinkCard.js +58 -42
- package/vue/chunks/UiEditorLinkForm.js +110 -90
- package/vue/chunks/UiEditorMentionMenu.js +23 -14
- package/vue/chunks/UiEditorMentionMenuItem.js +6 -2
- package/vue/chunks/UiEditorSlashMenu.js +24 -16
- package/vue/chunks/UiEditorSlashMenuGroup.js +1 -1
- package/vue/chunks/UiEditorSlashMenuItem.js +10 -6
- package/vue/chunks/UiEditorSurface.js +1 -1
- package/vue/chunks/UiEditorTableContextMenu.js +65 -53
- package/vue/chunks/UiEditorTableOverlay.js +60 -40
- package/vue/chunks/UiEditorTableToolbar.js +100 -74
- package/vue/chunks/UiEditorToolbar.js +1 -1
- package/vue/chunks/UiFloatingActionButton.js +1 -1
- package/vue/chunks/UiFormField.js +7 -3
- package/vue/chunks/UiGrid.js +1 -1
- package/vue/chunks/UiIcon.js +1 -1
- package/vue/chunks/UiIconButton.js +11 -7
- package/vue/chunks/UiImage.js +5 -2
- package/vue/chunks/UiInput.js +1 -1
- package/vue/chunks/UiInputGroup.js +5 -2
- package/vue/chunks/UiList.js +1 -1
- package/vue/chunks/UiListItem.js +9 -3
- package/vue/chunks/UiListbox.js +17 -11
- package/vue/chunks/UiMenu.js +1 -1
- package/vue/chunks/UiMenuGroup.js +7 -3
- package/vue/chunks/UiMenuItem.js +7 -2
- package/vue/chunks/UiMeter.js +28 -16
- package/vue/chunks/UiNavItem.js +20 -6
- package/vue/chunks/UiPageHeader.js +4 -2
- package/vue/chunks/UiPopover.js +1 -1
- package/vue/chunks/UiRadio.js +32 -24
- package/vue/chunks/UiRadioGroup.js +1 -1
- package/vue/chunks/UiReel.js +1 -1
- package/vue/chunks/UiScrollArea.js +1 -1
- package/vue/chunks/UiSearchResultRow.js +6 -2
- package/vue/chunks/UiSearchShell.js +1 -1
- package/vue/chunks/UiSection.js +15 -7
- package/vue/chunks/UiSelect.js +1 -1
- package/vue/chunks/UiSeparator.js +1 -1
- package/vue/chunks/UiSidebar.js +1 -1
- package/vue/chunks/UiSpinner.js +1 -1
- package/vue/chunks/UiStack.js +1 -1
- package/vue/chunks/UiStatusMessage.js +13 -7
- package/vue/chunks/UiSwatch.js +1 -1
- package/vue/chunks/UiSwitch.js +33 -25
- package/vue/chunks/UiSwitcher.js +1 -1
- package/vue/chunks/UiTable.js +1 -1
- package/vue/chunks/UiTabs.js +21 -17
- package/vue/chunks/UiText.js +1 -1
- package/vue/chunks/UiTextarea.js +1 -1
- package/vue/chunks/UiToast.js +1 -1
- package/vue/chunks/UiToastRegion.js +39 -31
- package/vue/chunks/UiTooltip.js +11 -3
- package/vue/chunks/UiTopBar.js +1 -1
- package/vue/chunks/UiTree.js +1 -1
- package/vue/chunks/UiTreeItem.js +25 -15
- package/vue/chunks/_plugin-vue_export-helper.js +1 -0
- package/vue/components.css +25 -21
- package/vue/editor/LoomaEditor.d.ts +90 -32
- package/vue/editor/index.d.ts +1 -1
- package/vue/editor/index.js +332 -53
- package/vue/host.ts +4 -1
package/vue/editor/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { computed, createApp, defineComponent, h, nextTick, onBeforeUnmount, onMounted, reactive, ref, shallowRef, useId, watch } from "vue";
|
|
1
|
+
import { computed, createApp, defineComponent, h, nextTick, onBeforeUnmount, onMounted, onUpdated, reactive, ref, shallowRef, useId, watch } from "vue";
|
|
2
2
|
import { DEFAULT_MENTION_RESULT_LIMIT, LOOMA_ICONS, createLoomaMentionExtension, createLoomaSlashCommandExtension, getActiveTableUiState, getDefaultEditorExtensions, getDefaultSlashCommands, getTableOfContentsEntries, getVisualViewportRect, handleTableAction, handleTableOverlayAction, measureTableOverlayGeometry, normalizeActiveTableColumnWidths, normalizeLoomaChipColor, normalizeTableOfContentsConfig } from "@threadlabs/looma/editor";
|
|
3
|
-
import { Button, Callout, Card, Checkbox, Cluster, Disclosure, EditorBlockActions, EditorChipEditor, EditorCodeLanguage, EditorImageToolbar, EditorInsertTableGrid, EditorLinkCard, EditorLinkForm, EditorMentionMenu, EditorMentionMenuItem, EditorSlashMenu, EditorSlashMenuGroup, EditorSlashMenuItem, EditorSurface, EditorTableContextMenu, EditorTableOverlay, EditorTableToolbar, EditorToolbar, FormField, Icon, IconButton, Image, Input, List, Menu, MenuItem, Popover, Separator, Stack, Text, Tooltip } from "@threadlabs/looma/vue";
|
|
3
|
+
import { Button, Callout, Card, Checkbox, Cluster, Disclosure, EditorBlockActions, EditorChipEditor, EditorCodeLanguage, EditorImageToolbar, EditorInsertTableGrid, EditorLinkCard, EditorLinkForm, EditorMentionMenu, EditorMentionMenuItem, EditorSlashMenu, EditorSlashMenuGroup, EditorSlashMenuItem, EditorSurface, EditorTableContextMenu, EditorTableOverlay, EditorTableToolbar, EditorToolbar, FormField, Icon, IconButton, Image, Input, List, Menu, MenuItem, Popover, Separator, Stack, StatusMessage, Text, Tooltip } from "@threadlabs/looma/vue";
|
|
4
4
|
import { Editor, Extension, Node as Node$1, getText, getTextSerializersFromSchema, isNodeSelection, mergeAttributes, nodeInputRule, posToDOMRect } from "@tiptap/core";
|
|
5
5
|
import { Editor as Editor$1 } from "@tiptap/vue-3";
|
|
6
6
|
import { closeHistory } from "@tiptap/pm/history";
|
|
@@ -1142,8 +1142,10 @@ function runBlockAction(editor, action) {
|
|
|
1142
1142
|
function createImageUploads(options) {
|
|
1143
1143
|
const { editor } = options;
|
|
1144
1144
|
const listeners = /* @__PURE__ */ new Set();
|
|
1145
|
+
const batches = /* @__PURE__ */ new Set();
|
|
1145
1146
|
let state = {
|
|
1146
1147
|
uploading: false,
|
|
1148
|
+
progress: null,
|
|
1147
1149
|
failed: null
|
|
1148
1150
|
};
|
|
1149
1151
|
const set = (patch) => {
|
|
@@ -1153,28 +1155,53 @@ function createImageUploads(options) {
|
|
|
1153
1155
|
};
|
|
1154
1156
|
listeners.forEach((listener) => listener());
|
|
1155
1157
|
};
|
|
1156
|
-
const insertOne = async (file) => {
|
|
1158
|
+
const insertOne = async (file, signal) => {
|
|
1157
1159
|
const upload = options.upload();
|
|
1158
|
-
if (!upload || editor.isDestroyed) return;
|
|
1159
|
-
set({
|
|
1160
|
+
if (!upload || editor.isDestroyed || signal.aborted) return;
|
|
1161
|
+
set({
|
|
1162
|
+
uploading: true,
|
|
1163
|
+
progress: null
|
|
1164
|
+
});
|
|
1160
1165
|
try {
|
|
1161
|
-
const
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1166
|
+
const image = await upload(file, {
|
|
1167
|
+
signal,
|
|
1168
|
+
progress: (loaded, total) => {
|
|
1169
|
+
if (!signal.aborted) set({ progress: {
|
|
1170
|
+
loaded,
|
|
1171
|
+
total
|
|
1172
|
+
} });
|
|
1173
|
+
}
|
|
1174
|
+
});
|
|
1175
|
+
if (image && !signal.aborted && !editor.isDestroyed) {
|
|
1176
|
+
const width = normalizeImageDimension(image.width);
|
|
1177
|
+
const height = normalizeImageDimension(image.height);
|
|
1178
|
+
editor.chain().focus().insertContent(imageUploadContent({
|
|
1179
|
+
src: image.src,
|
|
1180
|
+
alt: image.alt ?? file.name,
|
|
1181
|
+
...width ? { width } : {},
|
|
1182
|
+
...height ? { height } : {},
|
|
1183
|
+
...image.responsive === true ? { responsive: true } : {}
|
|
1184
|
+
})).run();
|
|
1185
|
+
}
|
|
1186
|
+
if (!signal.aborted) set({ failed: null });
|
|
1173
1187
|
} catch (error) {
|
|
1188
|
+
if (signal.aborted) return;
|
|
1174
1189
|
set({ failed: file });
|
|
1175
1190
|
options.onError(error, file);
|
|
1176
1191
|
} finally {
|
|
1177
|
-
set({
|
|
1192
|
+
set({
|
|
1193
|
+
uploading: false,
|
|
1194
|
+
progress: null
|
|
1195
|
+
});
|
|
1196
|
+
}
|
|
1197
|
+
};
|
|
1198
|
+
const run = async (files) => {
|
|
1199
|
+
const batch = new AbortController();
|
|
1200
|
+
batches.add(batch);
|
|
1201
|
+
try {
|
|
1202
|
+
for (const file of files) await insertOne(file, batch.signal);
|
|
1203
|
+
} finally {
|
|
1204
|
+
batches.delete(batch);
|
|
1178
1205
|
}
|
|
1179
1206
|
};
|
|
1180
1207
|
return {
|
|
@@ -1187,15 +1214,146 @@ function createImageUploads(options) {
|
|
|
1187
1214
|
listeners.delete(listener);
|
|
1188
1215
|
};
|
|
1189
1216
|
},
|
|
1190
|
-
|
|
1191
|
-
for (const file of files) await insertOne(file);
|
|
1192
|
-
},
|
|
1217
|
+
insert: run,
|
|
1193
1218
|
async retry() {
|
|
1194
|
-
if (state.failed) await
|
|
1219
|
+
if (state.failed) await run([state.failed]);
|
|
1220
|
+
},
|
|
1221
|
+
cancel() {
|
|
1222
|
+
batches.forEach((batch) => batch.abort(new DOMException("The upload was canceled.", "AbortError")));
|
|
1195
1223
|
}
|
|
1196
1224
|
};
|
|
1197
1225
|
}
|
|
1198
1226
|
//#endregion
|
|
1227
|
+
//#region ../../node_modules/.pnpm/@nextwebwg+html-next@1.0.0-alpha.54/node_modules/@nextwebwg/html-next/dist/requests.js
|
|
1228
|
+
/**
|
|
1229
|
+
* Requests: behavior a component asks its consumer for, answered through a native event's
|
|
1230
|
+
* `respondWith` (https://nextwebwg.org/declarative-components/javascript#requests).
|
|
1231
|
+
*
|
|
1232
|
+
* Every HTML Next bundle on a page (the live runtime, compiled modules and framework helpers) keeps
|
|
1233
|
+
* its requests in one record on the document, so any consumer answers any component, and one
|
|
1234
|
+
* document listener relays late responders. Converted framework components carry this module's
|
|
1235
|
+
* source (scripts/generate-literal-source.ts), so it imports nothing.
|
|
1236
|
+
*/
|
|
1237
|
+
var ports = /* @__PURE__ */ new WeakMap();
|
|
1238
|
+
var port = (event) => {
|
|
1239
|
+
let found = ports.get(event);
|
|
1240
|
+
if (found === void 0) ports.set(event, found = {});
|
|
1241
|
+
return found;
|
|
1242
|
+
};
|
|
1243
|
+
/** A request as its responders receive it: the nearest one answers with `respondWith`. */
|
|
1244
|
+
var RequestEvent = class extends CustomEvent {
|
|
1245
|
+
/** Aborts when the asker no longer needs the answer, or its component disconnects. */
|
|
1246
|
+
signal;
|
|
1247
|
+
constructor(type, init) {
|
|
1248
|
+
super(type, init);
|
|
1249
|
+
this.signal = init.signal;
|
|
1250
|
+
}
|
|
1251
|
+
/** Answer the request with a value or a promise of one; the event stops propagating. */
|
|
1252
|
+
respondWith(answer) {
|
|
1253
|
+
const recorded = port(this);
|
|
1254
|
+
if (this.eventPhase === 0 || recorded.a !== void 0) throw new DOMException(recorded.a === void 0 ? "A request is answered while it is dispatched." : "The request already has an answer.", "InvalidStateError");
|
|
1255
|
+
recorded.a = [answer];
|
|
1256
|
+
this.stopImmediatePropagation();
|
|
1257
|
+
}
|
|
1258
|
+
/** Report progress to the asker while the request is pending. */
|
|
1259
|
+
progress(loaded, total) {
|
|
1260
|
+
const report = this.signal.aborted ? void 0 : ports.get(this)?.p;
|
|
1261
|
+
try {
|
|
1262
|
+
report?.(loaded, total);
|
|
1263
|
+
} catch (error) {
|
|
1264
|
+
reportError(error);
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
};
|
|
1268
|
+
//#endregion
|
|
1269
|
+
//#region src/editor/requests.ts
|
|
1270
|
+
var AskedRequest = class extends RequestEvent {
|
|
1271
|
+
answered = false;
|
|
1272
|
+
answer;
|
|
1273
|
+
report;
|
|
1274
|
+
respondWith(answer) {
|
|
1275
|
+
super.respondWith(answer);
|
|
1276
|
+
this.answered = true;
|
|
1277
|
+
this.answer = answer;
|
|
1278
|
+
}
|
|
1279
|
+
progress(loaded, total) {
|
|
1280
|
+
if (this.signal.aborted) return;
|
|
1281
|
+
try {
|
|
1282
|
+
this.report?.(loaded, total);
|
|
1283
|
+
} catch (error) {
|
|
1284
|
+
reportError(error);
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
};
|
|
1288
|
+
/** Settles with `answer`, or rejects with the signal's reason when it aborts first. */
|
|
1289
|
+
var settle = (answer, signal) => new Promise((resolve, reject) => {
|
|
1290
|
+
const abort = () => reject(signal.reason);
|
|
1291
|
+
if (signal.aborted) abort();
|
|
1292
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
1293
|
+
Promise.resolve(answer).then((value) => {
|
|
1294
|
+
signal.removeEventListener("abort", abort);
|
|
1295
|
+
resolve(value);
|
|
1296
|
+
}, (error) => {
|
|
1297
|
+
signal.removeEventListener("abort", abort);
|
|
1298
|
+
reject(error);
|
|
1299
|
+
});
|
|
1300
|
+
});
|
|
1301
|
+
/**
|
|
1302
|
+
* Asks `name` at `root` as an HTML Next component's `host.request` does: dispatches a bubbling,
|
|
1303
|
+
* composed `RequestEvent`, and the nearest responder's answer settles it. A responder that answers
|
|
1304
|
+
* with a value, or no responder at all, settles it at once, so the answer is returned as it is; an
|
|
1305
|
+
* answer given as a promise is returned as a promise.
|
|
1306
|
+
*
|
|
1307
|
+
* @contract Settles `null` when no listener answers during the dispatch, or when the answer is `null`.
|
|
1308
|
+
* @failure Throws when the signal has already aborted. A promised answer rejects with the signal's
|
|
1309
|
+
* reason when it aborts before the answer arrives, and with the answer's own rejection.
|
|
1310
|
+
*/
|
|
1311
|
+
function askRequest(root, name, detail, options = {}) {
|
|
1312
|
+
const signal = options.signal ?? new AbortController().signal;
|
|
1313
|
+
signal.throwIfAborted();
|
|
1314
|
+
const event = new AskedRequest(name, {
|
|
1315
|
+
detail: detail ?? null,
|
|
1316
|
+
signal,
|
|
1317
|
+
bubbles: true,
|
|
1318
|
+
composed: true
|
|
1319
|
+
});
|
|
1320
|
+
event.report = options.progress;
|
|
1321
|
+
root.dispatchEvent(event);
|
|
1322
|
+
const answer = event.answered ? event.answer : null;
|
|
1323
|
+
if (!isThenable(answer)) {
|
|
1324
|
+
event.report = void 0;
|
|
1325
|
+
return answer ?? null;
|
|
1326
|
+
}
|
|
1327
|
+
return settle(answer, signal).then((value) => value ?? null).finally(() => {
|
|
1328
|
+
event.report = void 0;
|
|
1329
|
+
});
|
|
1330
|
+
}
|
|
1331
|
+
var isThenable = (value) => typeof value?.then === "function";
|
|
1332
|
+
/** Answers a request event with a responder function, as an HTML Next framework function prop does. */
|
|
1333
|
+
function respondWithFunction(event, responder) {
|
|
1334
|
+
const request = event;
|
|
1335
|
+
request.respondWith(responder(request.detail, {
|
|
1336
|
+
signal: request.signal,
|
|
1337
|
+
progress: (loaded, total) => request.progress(loaded, total)
|
|
1338
|
+
}));
|
|
1339
|
+
}
|
|
1340
|
+
/**
|
|
1341
|
+
* Calls `callback` with the request name when a responder announces itself, as HTML Next's
|
|
1342
|
+
* `respond()` does, on `root`, one of its ancestors, or the document.
|
|
1343
|
+
*
|
|
1344
|
+
* @lifecycle Listens on the document until the returned function is called.
|
|
1345
|
+
*/
|
|
1346
|
+
function onResponderAnnounced(root, callback) {
|
|
1347
|
+
const document = root.ownerDocument;
|
|
1348
|
+
const listener = (event) => {
|
|
1349
|
+
const name = event.detail?.name;
|
|
1350
|
+
const target = event.target;
|
|
1351
|
+
if (typeof name === "string" && target instanceof Node && target.contains(root)) callback(name);
|
|
1352
|
+
};
|
|
1353
|
+
document.addEventListener("responder", listener);
|
|
1354
|
+
return () => document.removeEventListener("responder", listener);
|
|
1355
|
+
}
|
|
1356
|
+
//#endregion
|
|
1199
1357
|
//#region src/editor/formatting-selection.ts
|
|
1200
1358
|
var HOLD_MS = 500;
|
|
1201
1359
|
var HOLD_SLOP_PX = 8;
|
|
@@ -2816,10 +2974,20 @@ var imageNodeView = ({ editor, node, getPos, decorations }) => {
|
|
|
2816
2974
|
};
|
|
2817
2975
|
//#endregion
|
|
2818
2976
|
//#region src/vue/editor/LoomaEditor.ts
|
|
2977
|
+
var EDITOR_REQUESTS = {
|
|
2978
|
+
extensions: "extensions",
|
|
2979
|
+
"slash-commands": "slashCommands",
|
|
2980
|
+
"mention-query": "mentionQuery",
|
|
2981
|
+
"link-search": "linkSearch",
|
|
2982
|
+
"link-resolve": "linkResolve",
|
|
2983
|
+
"image-upload": "imageUpload"
|
|
2984
|
+
};
|
|
2985
|
+
var EDITOR_REQUEST_NAMES = Object.keys(EDITOR_REQUESTS);
|
|
2819
2986
|
var EMPTY_DOCUMENT = {
|
|
2820
2987
|
type: "doc",
|
|
2821
2988
|
content: []
|
|
2822
2989
|
};
|
|
2990
|
+
var uploadProgressText = (progress) => progress && progress.total > 0 ? `Uploading image… ${Math.round(Math.min(1, progress.loaded / progress.total) * 100)}%` : "Uploading image…";
|
|
2823
2991
|
var editorInstanceSequence = 0;
|
|
2824
2992
|
var EMPTY_CAPABILITIES = {
|
|
2825
2993
|
canToggleHeaderRow: false,
|
|
@@ -2912,13 +3080,14 @@ var LoomaEditor = defineComponent({
|
|
|
2912
3080
|
type: String,
|
|
2913
3081
|
default: "Document"
|
|
2914
3082
|
},
|
|
3083
|
+
/** Answers `extensions`: the application's Tiptap extensions, added after Looma's. */
|
|
2915
3084
|
extensions: {
|
|
2916
|
-
type:
|
|
2917
|
-
default:
|
|
3085
|
+
type: Function,
|
|
3086
|
+
default: void 0
|
|
2918
3087
|
},
|
|
2919
|
-
/**
|
|
3088
|
+
/** Answers `slash-commands`: the slash menu's commands, given the defaults. */
|
|
2920
3089
|
slashCommands: {
|
|
2921
|
-
type:
|
|
3090
|
+
type: Function,
|
|
2922
3091
|
default: void 0
|
|
2923
3092
|
},
|
|
2924
3093
|
/** Override the lazy built-in catalog with application-owned code grammars. An empty object disables highlighting. */
|
|
@@ -2930,7 +3099,8 @@ var LoomaEditor = defineComponent({
|
|
|
2930
3099
|
type: Array,
|
|
2931
3100
|
default: () => []
|
|
2932
3101
|
},
|
|
2933
|
-
|
|
3102
|
+
/** Answers `mention-query`: people to suggest for what the author typed after `@`. */
|
|
3103
|
+
mentionQuery: {
|
|
2934
3104
|
type: Function,
|
|
2935
3105
|
default: void 0
|
|
2936
3106
|
},
|
|
@@ -2943,7 +3113,7 @@ var LoomaEditor = defineComponent({
|
|
|
2943
3113
|
type: String,
|
|
2944
3114
|
default: ""
|
|
2945
3115
|
},
|
|
2946
|
-
/**
|
|
3116
|
+
/** Answers `link-search` and `link-resolve`: host search and identity lookup for links to application records. */
|
|
2947
3117
|
linkSearch: {
|
|
2948
3118
|
type: Function,
|
|
2949
3119
|
default: void 0
|
|
@@ -2956,7 +3126,8 @@ var LoomaEditor = defineComponent({
|
|
|
2956
3126
|
type: String,
|
|
2957
3127
|
default: "Item"
|
|
2958
3128
|
},
|
|
2959
|
-
|
|
3129
|
+
/** Answers `image-upload`: uploads a pasted, dropped, or chosen image and returns the image to insert. */
|
|
3130
|
+
imageUpload: {
|
|
2960
3131
|
type: Function,
|
|
2961
3132
|
default: void 0
|
|
2962
3133
|
},
|
|
@@ -3086,6 +3257,7 @@ var LoomaEditor = defineComponent({
|
|
|
3086
3257
|
let uploads;
|
|
3087
3258
|
const uploadState = shallowRef({
|
|
3088
3259
|
uploading: false,
|
|
3260
|
+
progress: null,
|
|
3089
3261
|
failed: null
|
|
3090
3262
|
});
|
|
3091
3263
|
const tablePickerOpen = ref(false);
|
|
@@ -3182,12 +3354,77 @@ var LoomaEditor = defineComponent({
|
|
|
3182
3354
|
chipOpen.value = false;
|
|
3183
3355
|
if (focusChip) root.value?.querySelector(`#${chipAnchorId}`)?.focus();
|
|
3184
3356
|
};
|
|
3185
|
-
const
|
|
3186
|
-
|
|
3187
|
-
|
|
3357
|
+
const found = reactive(/* @__PURE__ */ new Set());
|
|
3358
|
+
const answers = (name) => {
|
|
3359
|
+
const prop = EDITOR_REQUESTS[name];
|
|
3360
|
+
return typeof props[prop] === "function" || attrs[`on${prop[0].toUpperCase()}${prop.slice(1)}`] != null || found.has(name);
|
|
3361
|
+
};
|
|
3362
|
+
const connection = new AbortController();
|
|
3363
|
+
const ask = (name, detail, options = {}) => {
|
|
3364
|
+
if (!root.value || connection.signal.aborted) return null;
|
|
3365
|
+
const signal = options.signal ? AbortSignal.any([options.signal, connection.signal]) : connection.signal;
|
|
3366
|
+
return askRequest(root.value, name, detail, {
|
|
3367
|
+
...options,
|
|
3368
|
+
signal
|
|
3369
|
+
});
|
|
3370
|
+
};
|
|
3371
|
+
const latest = /* @__PURE__ */ new Map();
|
|
3372
|
+
const askLatest = (name, detail) => {
|
|
3373
|
+
latest.get(name)?.abort();
|
|
3374
|
+
const controller = new AbortController();
|
|
3375
|
+
latest.set(name, controller);
|
|
3376
|
+
return ask(name, detail, { signal: controller.signal });
|
|
3377
|
+
};
|
|
3378
|
+
const askThen = (name, detail, apply) => {
|
|
3379
|
+
const answer = askLatest(name, detail);
|
|
3380
|
+
if (!(answer instanceof Promise)) return apply(answer);
|
|
3381
|
+
const controller = latest.get(name);
|
|
3382
|
+
answer.then(apply, (error) => {
|
|
3383
|
+
if (controller !== latest.get(name) || connection.signal.aborted) return;
|
|
3384
|
+
reportError(error);
|
|
3385
|
+
apply(null);
|
|
3386
|
+
});
|
|
3188
3387
|
};
|
|
3388
|
+
let slashDefaults;
|
|
3389
|
+
const defaultSlashCommands = () => {
|
|
3390
|
+
const uploads = answers("image-upload");
|
|
3391
|
+
if (slashDefaults?.uploads !== uploads) slashDefaults = {
|
|
3392
|
+
uploads,
|
|
3393
|
+
commands: getDefaultSlashCommands(uploads ? () => fileInput.value?.click() : void 0, openChipEditor, () => openLinkEditor())
|
|
3394
|
+
};
|
|
3395
|
+
return slashDefaults.commands;
|
|
3396
|
+
};
|
|
3397
|
+
const askSlashCommands = () => {
|
|
3398
|
+
const defaults = defaultSlashCommands();
|
|
3399
|
+
askThen("slash-commands", { defaults: [...defaults] }, (answer) => {
|
|
3400
|
+
const commands = answer ?? defaults;
|
|
3401
|
+
const current = slashExtension.options.commands;
|
|
3402
|
+
if (commands.length === current.length && commands.every((command, index) => command === current[index])) return;
|
|
3403
|
+
slashExtension.options.commands = commands;
|
|
3404
|
+
editor.value?.commands.dismissLoomaSlashMenu();
|
|
3405
|
+
});
|
|
3406
|
+
};
|
|
3407
|
+
let consumerExtensions = [];
|
|
3408
|
+
const askExtensions = () => askThen("extensions", null, (extensions) => {
|
|
3409
|
+
const changed = Boolean(extensions?.length || consumerExtensions.length);
|
|
3410
|
+
consumerExtensions = extensions ?? [];
|
|
3411
|
+
if (!session) build(props.modelValue);
|
|
3412
|
+
else if (changed) rebuild();
|
|
3413
|
+
});
|
|
3414
|
+
let responders = /* @__PURE__ */ new Set();
|
|
3415
|
+
const checkResponders = () => {
|
|
3416
|
+
const current = new Set(EDITOR_REQUEST_NAMES.filter(answers));
|
|
3417
|
+
const arrived = (name) => current.has(name) && !responders.has(name);
|
|
3418
|
+
const extensionsArrived = arrived("extensions");
|
|
3419
|
+
const slashChanged = arrived("slash-commands") || current.has("image-upload") !== responders.has("image-upload");
|
|
3420
|
+
responders = current;
|
|
3421
|
+
if (extensionsArrived) askExtensions();
|
|
3422
|
+
if (slashChanged) askSlashCommands();
|
|
3423
|
+
};
|
|
3424
|
+
onUpdated(checkResponders);
|
|
3425
|
+
let stopAnnouncements;
|
|
3189
3426
|
const slashExtension = createLoomaSlashCommandExtension({
|
|
3190
|
-
commands:
|
|
3427
|
+
commands: defaultSlashCommands(),
|
|
3191
3428
|
onOpenImagePicker: () => fileInput.value?.click(),
|
|
3192
3429
|
onOpenChipEditor: openChipEditor,
|
|
3193
3430
|
onOpenLinkEditor: () => openLinkEditor(),
|
|
@@ -3196,13 +3433,13 @@ var LoomaEditor = defineComponent({
|
|
|
3196
3433
|
}
|
|
3197
3434
|
});
|
|
3198
3435
|
const mentionMenuId = `looma-editor-mention-menu-${++editorInstanceSequence}`;
|
|
3199
|
-
const mentionExtension =
|
|
3436
|
+
const mentionExtension = createLoomaMentionExtension({
|
|
3200
3437
|
limit: props.mentionLimit,
|
|
3201
3438
|
menuId: mentionMenuId,
|
|
3202
|
-
items: async (query, context) => {
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
},
|
|
3439
|
+
items: async (query, context) => await askLatest("mention-query", {
|
|
3440
|
+
query,
|
|
3441
|
+
limit: context.limit
|
|
3442
|
+
}) ?? props.mentionItems,
|
|
3206
3443
|
onStateChange: (state) => {
|
|
3207
3444
|
Object.assign(mention, state);
|
|
3208
3445
|
}
|
|
@@ -3234,13 +3471,16 @@ var LoomaEditor = defineComponent({
|
|
|
3234
3471
|
const loadForCodeBlock = codeHighlighting.loadForCodeBlock;
|
|
3235
3472
|
const editor = shallowRef();
|
|
3236
3473
|
let session;
|
|
3237
|
-
|
|
3474
|
+
let edited = false;
|
|
3475
|
+
const build = (content) => {
|
|
3476
|
+
edited = false;
|
|
3477
|
+
const consumerMention = consumerExtensions.some((extension) => extension.name === "mention");
|
|
3238
3478
|
session = createEditorSession({
|
|
3239
3479
|
extensions: [
|
|
3240
3480
|
...getDefaultEditorExtensions({
|
|
3241
3481
|
placeholder: props.placeholder,
|
|
3242
3482
|
linkBaseUrl: props.linkBaseUrl,
|
|
3243
|
-
mention:
|
|
3483
|
+
mention: consumerMention ? false : mentionExtension,
|
|
3244
3484
|
disableHighlight: props.disableHighlight,
|
|
3245
3485
|
codeLanguages: props.codeLanguages ?? void 0,
|
|
3246
3486
|
codeLowlight: codeHighlighting.lowlight,
|
|
@@ -3252,9 +3492,9 @@ var LoomaEditor = defineComponent({
|
|
|
3252
3492
|
}),
|
|
3253
3493
|
imageDelivery.extension,
|
|
3254
3494
|
slashExtension,
|
|
3255
|
-
...
|
|
3495
|
+
...consumerExtensions
|
|
3256
3496
|
],
|
|
3257
|
-
content
|
|
3497
|
+
content,
|
|
3258
3498
|
editable: props.editable,
|
|
3259
3499
|
editorProps: {
|
|
3260
3500
|
nodeViews: { image: () => ({ dom: document.createElement("span") }) },
|
|
@@ -3304,6 +3544,7 @@ var LoomaEditor = defineComponent({
|
|
|
3304
3544
|
}
|
|
3305
3545
|
},
|
|
3306
3546
|
onUpdate: ({ editor: instance }) => {
|
|
3547
|
+
edited = true;
|
|
3307
3548
|
const value = instance.getJSON();
|
|
3308
3549
|
emit("update:modelValue", value);
|
|
3309
3550
|
emit("update", value);
|
|
@@ -3316,8 +3557,8 @@ var LoomaEditor = defineComponent({
|
|
|
3316
3557
|
editor.value = session.editor;
|
|
3317
3558
|
const engine = createLinkEditing({
|
|
3318
3559
|
editor: session.editor,
|
|
3319
|
-
search: () =>
|
|
3320
|
-
resolve: () =>
|
|
3560
|
+
search: () => answers("link-search") ? async (query) => await askLatest("link-search", { query }) ?? [] : null,
|
|
3561
|
+
resolve: () => async (href) => await askLatest("link-resolve", { href }),
|
|
3321
3562
|
baseUrl: () => props.linkBaseUrl
|
|
3322
3563
|
});
|
|
3323
3564
|
engine.subscribe(() => {
|
|
@@ -3326,7 +3567,14 @@ var LoomaEditor = defineComponent({
|
|
|
3326
3567
|
linkEditing = engine;
|
|
3327
3568
|
const imageUploads = createImageUploads({
|
|
3328
3569
|
editor: session.editor,
|
|
3329
|
-
upload: () =>
|
|
3570
|
+
upload: () => async (file, init) => {
|
|
3571
|
+
const image = await ask("image-upload", { file }, init);
|
|
3572
|
+
if (image && !found.has("image-upload")) {
|
|
3573
|
+
found.add("image-upload");
|
|
3574
|
+
checkResponders();
|
|
3575
|
+
}
|
|
3576
|
+
return image;
|
|
3577
|
+
},
|
|
3330
3578
|
onError: (error, file) => emit("uploadError", error, file)
|
|
3331
3579
|
});
|
|
3332
3580
|
imageUploads.subscribe(() => {
|
|
@@ -3344,6 +3592,30 @@ var LoomaEditor = defineComponent({
|
|
|
3344
3592
|
formattingPopup?.show();
|
|
3345
3593
|
}
|
|
3346
3594
|
});
|
|
3595
|
+
};
|
|
3596
|
+
const rebuild = () => {
|
|
3597
|
+
const previous = session;
|
|
3598
|
+
const content = edited ? previous.editor.getJSON() : props.modelValue;
|
|
3599
|
+
linkEditing?.destroy();
|
|
3600
|
+
formatting?.destroy();
|
|
3601
|
+
uploads?.cancel();
|
|
3602
|
+
previous.destroy();
|
|
3603
|
+
build(content);
|
|
3604
|
+
};
|
|
3605
|
+
onMounted(() => {
|
|
3606
|
+
const element = root.value;
|
|
3607
|
+
for (const name of EDITOR_REQUEST_NAMES) element.addEventListener(name, (event) => {
|
|
3608
|
+
const responder = props[EDITOR_REQUESTS[name]];
|
|
3609
|
+
if (typeof responder === "function" && "respondWith" in event) respondWithFunction(event, responder);
|
|
3610
|
+
}, { capture: true });
|
|
3611
|
+
stopAnnouncements = onResponderAnnounced(element, (name) => {
|
|
3612
|
+
if (!(name in EDITOR_REQUESTS)) return;
|
|
3613
|
+
found.add(name);
|
|
3614
|
+
checkResponders();
|
|
3615
|
+
});
|
|
3616
|
+
responders = new Set(EDITOR_REQUEST_NAMES.filter(answers));
|
|
3617
|
+
askExtensions();
|
|
3618
|
+
askSlashCommands();
|
|
3347
3619
|
});
|
|
3348
3620
|
const attachDocument = (element) => {
|
|
3349
3621
|
if (element instanceof HTMLElement) session?.attach(element);
|
|
@@ -3351,6 +3623,8 @@ var LoomaEditor = defineComponent({
|
|
|
3351
3623
|
onBeforeUnmount(() => {
|
|
3352
3624
|
const element = session?.editor.options.element;
|
|
3353
3625
|
element?.parentNode?.replaceChild(element.cloneNode(true), element);
|
|
3626
|
+
connection.abort();
|
|
3627
|
+
stopAnnouncements?.();
|
|
3354
3628
|
linkEditing?.destroy();
|
|
3355
3629
|
session?.destroy();
|
|
3356
3630
|
});
|
|
@@ -3384,10 +3658,10 @@ var LoomaEditor = defineComponent({
|
|
|
3384
3658
|
ref: setLinkFormRoot,
|
|
3385
3659
|
class: "looma-editor__link-form",
|
|
3386
3660
|
existing: Boolean(state.range?.existing),
|
|
3387
|
-
searchable:
|
|
3661
|
+
searchable: answers("link-search"),
|
|
3388
3662
|
mode: state.mode,
|
|
3389
|
-
value:
|
|
3390
|
-
placeholder:
|
|
3663
|
+
value: answers("link-search") ? state.query : state.href,
|
|
3664
|
+
placeholder: answers("link-search") ? `Search ${props.linkTargetLabel.toLowerCase()}s or paste a URL…` : "https://example.com",
|
|
3391
3665
|
newTab: state.newTab,
|
|
3392
3666
|
textEditable: state.textEditable,
|
|
3393
3667
|
text: state.text,
|
|
@@ -3437,10 +3711,7 @@ var LoomaEditor = defineComponent({
|
|
|
3437
3711
|
onRemove: () => linkEditing?.remove()
|
|
3438
3712
|
});
|
|
3439
3713
|
};
|
|
3440
|
-
watch(
|
|
3441
|
-
slashExtension.options.commands = resolveSlashCommands();
|
|
3442
|
-
editor.value?.commands.dismissLoomaSlashMenu();
|
|
3443
|
-
});
|
|
3714
|
+
watch(() => props.slashCommands, askSlashCommands);
|
|
3444
3715
|
watch(() => props.editable, (editable) => {
|
|
3445
3716
|
formatting?.press.cancel();
|
|
3446
3717
|
formatting?.release();
|
|
@@ -4205,7 +4476,7 @@ var LoomaEditor = defineComponent({
|
|
|
4205
4476
|
variant: tablePickerOpen.value ? "solid" : "ghost",
|
|
4206
4477
|
"aria-expanded": tablePickerOpen.value ? "true" : "false"
|
|
4207
4478
|
}, () => loomaIcon("table")),
|
|
4208
|
-
commandButton(uploadState.value.uploading ? "Uploading image" : "Insert image", "image", false, uploadState.value.uploading || !
|
|
4479
|
+
commandButton(uploadState.value.uploading ? "Uploading image" : "Insert image", "image", false, uploadState.value.uploading || !answers("image-upload"), () => fileInput.value?.click()),
|
|
4209
4480
|
h("span", {
|
|
4210
4481
|
class: "divider",
|
|
4211
4482
|
"aria-hidden": "true"
|
|
@@ -4396,6 +4667,14 @@ var LoomaEditor = defineComponent({
|
|
|
4396
4667
|
"aria-hidden": "true",
|
|
4397
4668
|
onChange: onFileChange
|
|
4398
4669
|
}),
|
|
4670
|
+
uploadState.value.uploading ? h(StatusMessage, { kind: "loading" }, {
|
|
4671
|
+
default: () => uploadProgressText(uploadState.value.progress),
|
|
4672
|
+
action: () => h(Button, {
|
|
4673
|
+
size: "sm",
|
|
4674
|
+
variant: "ghost",
|
|
4675
|
+
onClick: () => uploads?.cancel()
|
|
4676
|
+
}, () => "Cancel")
|
|
4677
|
+
}) : null,
|
|
4399
4678
|
uploadState.value.failed ? h("div", {
|
|
4400
4679
|
class: "looma-editor__upload-error",
|
|
4401
4680
|
role: "alert"
|
package/vue/host.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated by HTML Next 1.0.0-alpha.
|
|
1
|
+
// Generated by HTML Next 1.0.0-alpha.54 for Vue 3.5. Do not edit.
|
|
2
2
|
import {
|
|
3
3
|
computed,
|
|
4
4
|
createTextVNode,
|
|
@@ -535,6 +535,8 @@ export interface ComponentHostOptions {
|
|
|
535
535
|
readonly data?: Readonly<Record<string, Readable<unknown>>>
|
|
536
536
|
/** Values inherited through declared context, which a controller reads. */
|
|
537
537
|
readonly context?: Readonly<Record<string, Readable<unknown>>>
|
|
538
|
+
/** Each named declared script, which a controller reads as `host.scripts`. */
|
|
539
|
+
readonly scripts?: Readonly<Record<string, unknown>>
|
|
538
540
|
readonly acceptsState?: (name: string, keys: readonly string[], value: unknown) => boolean
|
|
539
541
|
/** Asks one of the component's declared requests. */
|
|
540
542
|
request?(
|
|
@@ -700,6 +702,7 @@ export function useComponentHost(
|
|
|
700
702
|
),
|
|
701
703
|
...(options.acceptsState === undefined ? {} : { acceptsState: options.acceptsState }),
|
|
702
704
|
}, options.controllerSource?.definition ?? '<component>'),
|
|
705
|
+
scripts: options.scripts ?? Object.freeze({}),
|
|
703
706
|
on(type: string, callback: (event: Event) => void | (() => void)): () => void {
|
|
704
707
|
const entry: Subscription = {
|
|
705
708
|
type,
|