@threadlabs/looma 0.23.14 → 0.23.16

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.
@@ -23,9 +23,10 @@ export type LoomaImageUploader = (file: File) => Promise<string | LoomaImageUplo
23
23
  /**
24
24
  * Chooses whether formatting controls follow a selection, occupy persistent
25
25
  * editor chrome, or open from an app-owned button (`popover`, with a text-only
26
- * bubble for selections); it does not alter document commands or stored content.
26
+ * bubble for selections). `contextual` exposes all commands at a focused caret
27
+ * as well as a selection; it does not alter document commands or stored content.
27
28
  */
28
- export type LoomaEditorToolbarMode = "bubble" | "sticky" | "popover";
29
+ export type LoomaEditorToolbarMode = "bubble" | "sticky" | "popover" | "contextual";
29
30
  /** A destination supplied by the host application, such as a page or record. */
30
31
  export interface LoomaLinkTarget {
31
32
  id: string;
@@ -1990,10 +1990,10 @@ var LoomaEditor = defineComponent({
1990
1990
  onDblclick: onImageDoubleClick,
1991
1991
  onKeydown: onImageKeyDown
1992
1992
  }, [
1993
- instance && props.editable && !mobile.value && (props.toolbarMode === "bubble" || props.toolbarMode === "popover") ? h(BubbleMenu, {
1993
+ instance && props.editable && !mobile.value && (props.toolbarMode === "bubble" || props.toolbarMode === "popover" || props.toolbarMode === "contextual") ? h(BubbleMenu, {
1994
1994
  editor: instance,
1995
1995
  pluginKey: "looma-text-formatting-menu",
1996
- shouldShow: ({ editor: menuEditor, from, to }) => (props.toolbarMode !== "popover" || !props.toolbarOpen) && shouldShowTextFormattingToolbar(menuEditor, from, to),
1996
+ shouldShow: ({ editor: menuEditor, from, to }) => (props.toolbarMode !== "popover" || !props.toolbarOpen) && (props.toolbarMode === "contextual" ? menuEditor.isFocused : shouldShowTextFormattingToolbar(menuEditor, from, to)),
1997
1997
  tippyOptions: {
1998
1998
  appendTo: () => root.value?.closest("dialog[open], [popover]") ?? document.body,
1999
1999
  onShow: () => announceOverlayOpen(root.value?.ownerDocument ?? document, root.value),