@threadlabs/looma 0.22.12 → 0.22.13

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.
@@ -9778,13 +9778,14 @@ var CALLOUT_COMMANDS = [
9778
9778
  ];
9779
9779
  /**
9780
9780
  * Builds Looma's default command policy as fresh objects for one editor.
9781
- * The image command delegates asset selection because Looma does not own upload,
9782
- * persistence, or media-library concerns.
9781
+ * Image and link commands delegate their picker because Looma does not own
9782
+ * upload, persistence, or destination search. Link appears only when a picker
9783
+ * callback is supplied, so a headless default inventory has no dead action.
9783
9784
  *
9784
9785
  * @ownership Returned command objects belong to the caller and are recreated
9785
9786
  * per call so one editor cannot mutate another editor's command inventory.
9786
9787
  */
9787
- function getDefaultSlashCommands(onOpenImagePicker, onOpenChipEditor) {
9788
+ function getDefaultSlashCommands(onOpenImagePicker, onOpenChipEditor, onOpenLinkEditor) {
9788
9789
  return [
9789
9790
  {
9790
9791
  title: "Text",
@@ -9950,6 +9951,20 @@ function getDefaultSlashCommands(onOpenImagePicker, onOpenChipEditor) {
9950
9951
  editor.chain().focus().deleteRange(range).setHorizontalRule().run();
9951
9952
  }
9952
9953
  },
9954
+ ...onOpenLinkEditor ? [{
9955
+ title: "Link",
9956
+ description: "Link to a destination or URL",
9957
+ icon: "link",
9958
+ keywords: [
9959
+ "link",
9960
+ "url",
9961
+ "website"
9962
+ ],
9963
+ command: ({ editor, range }) => {
9964
+ editor.chain().focus().deleteRange(range).run();
9965
+ onOpenLinkEditor();
9966
+ }
9967
+ }] : [],
9953
9968
  {
9954
9969
  title: "Image",
9955
9970
  description: "Upload an image",
@@ -10081,9 +10096,10 @@ var LoomaSlashCommand = Extension.create({
10081
10096
  function createLoomaSlashCommandExtension(options = {}) {
10082
10097
  const onOpenImagePicker = options.onOpenImagePicker;
10083
10098
  const onOpenChipEditor = options.onOpenChipEditor;
10099
+ const onOpenLinkEditor = options.onOpenLinkEditor;
10084
10100
  return LoomaSlashCommand.configure({
10085
10101
  ...options,
10086
- commands: options.commands ?? getDefaultSlashCommands(onOpenImagePicker, onOpenChipEditor)
10102
+ commands: options.commands ?? getDefaultSlashCommands(onOpenImagePicker, onOpenChipEditor, onOpenLinkEditor)
10087
10103
  });
10088
10104
  }
10089
10105
  //#endregion
@@ -49,16 +49,18 @@ export interface LoomaSlashCommandOptions {
49
49
  onStateChange?: (state: LoomaSlashMenuSnapshot) => void;
50
50
  onOpenImagePicker?: () => void;
51
51
  onOpenChipEditor?: (editor: Editor, position: number) => void;
52
+ onOpenLinkEditor?: () => void;
52
53
  }
53
54
  /**
54
55
  * Builds Looma's default command policy as fresh objects for one editor.
55
- * The image command delegates asset selection because Looma does not own upload,
56
- * persistence, or media-library concerns.
56
+ * Image and link commands delegate their picker because Looma does not own
57
+ * upload, persistence, or destination search. Link appears only when a picker
58
+ * callback is supplied, so a headless default inventory has no dead action.
57
59
  *
58
60
  * @ownership Returned command objects belong to the caller and are recreated
59
61
  * per call so one editor cannot mutate another editor's command inventory.
60
62
  */
61
- export declare function getDefaultSlashCommands(onOpenImagePicker?: () => void, onOpenChipEditor?: (editor: Editor, position: number) => void): LoomaSlashCommand[];
63
+ export declare function getDefaultSlashCommands(onOpenImagePicker?: () => void, onOpenChipEditor?: (editor: Editor, position: number) => void, onOpenLinkEditor?: () => void): LoomaSlashCommand[];
62
64
  /**
63
65
  * Framework-neutral slash-command extension used by the turnkey editor.
64
66
  * Consumers embedding Looma into their own Tiptap instance can configure the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threadlabs/looma",
3
- "version": "0.22.12",
3
+ "version": "0.22.13",
4
4
  "type": "module",
5
5
  "description": "Looma components as HTML, Vue, and plain DOM, with design tokens.",
6
6
  "license": "MIT",
@@ -9092,6 +9092,10 @@ html[data-ui-input-modality="touch"]
9092
9092
  color: var(--ui-text-primary);
9093
9093
  }
9094
9094
 
9095
+ .looma-editor__link-context-kind {
9096
+ font-size: var(--ui-font-size-xs);
9097
+ }
9098
+
9095
9099
  .looma-editor__link-context-actions :is(button, a) {
9096
9100
  display: inline-flex;
9097
9101
  flex: 0 0 auto;
@@ -769,6 +769,7 @@ var LoomaEditor = defineComponent({
769
769
  const slashExtension = createLoomaSlashCommandExtension({
770
770
  onOpenImagePicker: () => fileInput.value?.click(),
771
771
  onOpenChipEditor: openChipEditor,
772
+ onOpenLinkEditor: () => openLinkEditor(),
772
773
  onStateChange: (state) => {
773
774
  Object.assign(slash, state);
774
775
  }
@@ -1163,7 +1164,7 @@ var LoomaEditor = defineComponent({
1163
1164
  h("span", {
1164
1165
  class: "looma-editor__link-context-url",
1165
1166
  title: href
1166
- }, linkContextTarget.value ? [h("strong", linkContextTarget.value.label), linkContextTarget.value.detail ? h("small", linkContextTarget.value.detail) : null] : href),
1167
+ }, [h("small", { class: "looma-editor__link-context-kind" }, linkContextTarget.value ? props.linkTargetLabel : "External URL"), ...linkContextTarget.value ? [h("strong", linkContextTarget.value.label), linkContextTarget.value.detail ? h("small", linkContextTarget.value.detail) : null] : [href]]),
1167
1168
  h("button", {
1168
1169
  type: "button",
1169
1170
  onPointerdown: (event) => event.preventDefault(),