@threadlabs/looma 0.28.10 → 0.28.12
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-chip-editor/ui-editor-chip-editor.html +32 -0
- package/components/ui-editor-chip-editor/ui-editor-chip-editor.js +33 -0
- package/components/ui-radio-group/ui-radio-group.html +13 -1
- package/components/ui-swatch/ui-swatch.html +69 -0
- package/dist/index.js +38 -37
- package/editor/block-actions.d.ts +9 -0
- package/editor/extensions/table-commands.d.ts +7 -1
- package/package.json +1 -1
- package/styles/ui-editor-chip-editor.css +1 -0
- package/styles/ui-radio-group.css +9 -0
- package/styles/ui-swatch.css +76 -0
- package/vanilla/UiEditorChipEditor.d.ts +18 -0
- package/vanilla/UiEditorChipEditor.js +45 -0
- package/vanilla/UiRadioGroup.d.ts +1 -0
- package/vanilla/UiRadioGroup.js +18 -13
- package/vanilla/UiSwatch.d.ts +14 -0
- package/vanilla/UiSwatch.js +54 -0
- package/vanilla/index.js +2 -0
- package/vue/UiEditorChipEditor.d.ts +45 -0
- package/vue/UiEditorChipEditor.js +2 -0
- package/vue/UiEditorChipEditor.vue +163 -0
- package/vue/UiRadioGroup.d.ts +9 -0
- package/vue/UiRadioGroup.vue +44 -2
- package/vue/UiSwatch.d.ts +16 -0
- package/vue/UiSwatch.js +2 -0
- package/vue/UiSwatch.vue +150 -0
- package/vue/chunks/UiEditorChipEditor.js +157 -0
- package/vue/chunks/UiEditorImageToolbar.js +2 -2
- package/vue/chunks/UiEditorLinkCard.js +1 -1
- package/vue/chunks/UiEditorLinkForm.js +2 -2
- package/vue/chunks/UiRadioGroup.js +26 -3
- package/vue/chunks/UiSwatch.js +78 -0
- package/vue/components.css +461 -443
- package/vue/editor/index.js +148 -105
- package/vue/editor/primitives.d.ts +9 -1
- package/vue/index.d.ts +2 -0
- package/vue/index.js +6 -4
package/vue/editor/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { computed, createApp, defineComponent, h, nextTick, onBeforeUnmount, onMounted, reactive, ref, shallowRef, useId, watch } from "vue";
|
|
2
|
-
import { DEFAULT_MENTION_RESULT_LIMIT,
|
|
3
|
-
import { Button, Callout, Card, Checkbox, Cluster, Disclosure, EditorBlockActions, 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";
|
|
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";
|
|
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";
|
|
7
7
|
import { AllSelection, NodeSelection, Plugin, PluginKey, TextSelection } from "@tiptap/pm/state";
|
|
8
8
|
import { Decoration, DecorationSet } from "@tiptap/pm/view";
|
|
9
9
|
import { createLowlight } from "lowlight";
|
|
10
|
+
import "@tiptap/pm/tables";
|
|
10
11
|
import "@tiptap/pm/transform";
|
|
11
12
|
import { DOMParser, DOMSerializer, Fragment as Fragment$1 } from "@tiptap/pm/model";
|
|
12
13
|
export * from "@threadlabs/looma/editor";
|
|
@@ -27,7 +28,8 @@ var EDITOR_ADAPTER_COMPONENT_TAG_MAP = {
|
|
|
27
28
|
EditorLinkCard: "ui-editor-link-card",
|
|
28
29
|
EditorLinkForm: "ui-editor-link-form",
|
|
29
30
|
EditorBlockActions: "ui-editor-block-actions",
|
|
30
|
-
EditorCodeLanguage: "ui-editor-code-language"
|
|
31
|
+
EditorCodeLanguage: "ui-editor-code-language",
|
|
32
|
+
EditorChipEditor: "ui-editor-chip-editor"
|
|
31
33
|
};
|
|
32
34
|
//#endregion
|
|
33
35
|
//#region src/components/shared/overlay.js
|
|
@@ -1094,6 +1096,125 @@ function createCodeHighlighting(codeLanguages, onGrammarsLoaded) {
|
|
|
1094
1096
|
};
|
|
1095
1097
|
}
|
|
1096
1098
|
//#endregion
|
|
1099
|
+
//#region src/editor/block-actions.ts
|
|
1100
|
+
/**
|
|
1101
|
+
* Applies a block menu action to the top-level block holding the caret, then focuses the editor:
|
|
1102
|
+
* insert a paragraph below, duplicate the block, or delete it. Deleting the only block leaves an
|
|
1103
|
+
* empty paragraph.
|
|
1104
|
+
*
|
|
1105
|
+
* @failure Returns false, and changes nothing, for an unknown action or a caret outside any block.
|
|
1106
|
+
*/
|
|
1107
|
+
function runBlockAction(editor, action) {
|
|
1108
|
+
const head = editor.state.selection.$head;
|
|
1109
|
+
if (head.depth === 0) return false;
|
|
1110
|
+
const { state } = editor;
|
|
1111
|
+
const position = head.before(1);
|
|
1112
|
+
const block = state.doc.nodeAt(position);
|
|
1113
|
+
if (!block) return false;
|
|
1114
|
+
const end = position + block.nodeSize;
|
|
1115
|
+
const transaction = state.tr;
|
|
1116
|
+
let focusAt = end + 1;
|
|
1117
|
+
if (action === "insert-below") transaction.insert(end, state.schema.nodes.paragraph.create());
|
|
1118
|
+
else if (action === "duplicate") transaction.insert(end, block);
|
|
1119
|
+
else if (action === "delete") {
|
|
1120
|
+
if (state.doc.childCount === 1) {
|
|
1121
|
+
transaction.replaceWith(position, end, state.schema.nodes.paragraph.create());
|
|
1122
|
+
focusAt = 1;
|
|
1123
|
+
} else {
|
|
1124
|
+
transaction.delete(position, end);
|
|
1125
|
+
focusAt = Math.min(position + 1, transaction.doc.content.size);
|
|
1126
|
+
}
|
|
1127
|
+
} else return false;
|
|
1128
|
+
transaction.setSelection(TextSelection.near(transaction.doc.resolve(Math.min(focusAt, transaction.doc.content.size))));
|
|
1129
|
+
editor.view.dispatch(transaction);
|
|
1130
|
+
editor.commands.focus();
|
|
1131
|
+
return true;
|
|
1132
|
+
}
|
|
1133
|
+
//#endregion
|
|
1134
|
+
//#region src/editor/table-overlay.ts
|
|
1135
|
+
function mapTableCells(table) {
|
|
1136
|
+
const rows = Array.from(table.rows);
|
|
1137
|
+
const grid = [];
|
|
1138
|
+
const coordinates = /* @__PURE__ */ new Map();
|
|
1139
|
+
rows.forEach((row, rowIndex) => {
|
|
1140
|
+
grid[rowIndex] ??= [];
|
|
1141
|
+
let columnIndex = 0;
|
|
1142
|
+
for (const cell of Array.from(row.cells)) {
|
|
1143
|
+
while (grid[rowIndex]?.[columnIndex]) columnIndex += 1;
|
|
1144
|
+
coordinates.set(cell, {
|
|
1145
|
+
rowIndex,
|
|
1146
|
+
columnIndex
|
|
1147
|
+
});
|
|
1148
|
+
const rowSpan = cell.rowSpan === 0 ? rows.length - rowIndex : Math.max(1, cell.rowSpan);
|
|
1149
|
+
const columnSpan = Math.max(1, cell.colSpan);
|
|
1150
|
+
for (let rowOffset = 0; rowOffset < rowSpan; rowOffset += 1) {
|
|
1151
|
+
const gridRow = grid[rowIndex + rowOffset] ??= [];
|
|
1152
|
+
for (let columnOffset = 0; columnOffset < columnSpan; columnOffset += 1) gridRow[columnIndex + columnOffset] = cell;
|
|
1153
|
+
}
|
|
1154
|
+
columnIndex += columnSpan;
|
|
1155
|
+
}
|
|
1156
|
+
});
|
|
1157
|
+
return {
|
|
1158
|
+
grid,
|
|
1159
|
+
coordinates
|
|
1160
|
+
};
|
|
1161
|
+
}
|
|
1162
|
+
/**
|
|
1163
|
+
* Resolves a logical grid coordinate to its owning DOM cell.
|
|
1164
|
+
* A spanning cell can therefore be returned for more than one coordinate; this
|
|
1165
|
+
* is intentional and prevents overlay actions from inventing nonexistent cells.
|
|
1166
|
+
*
|
|
1167
|
+
* @contract Coordinates outside the expanded table grid return null; coordinates
|
|
1168
|
+
* covered by a span resolve to the single DOM cell that owns them.
|
|
1169
|
+
*/
|
|
1170
|
+
function resolveTableCellAt(table, rowIndex, columnIndex) {
|
|
1171
|
+
return mapTableCells(table).grid[rowIndex]?.[columnIndex] ?? null;
|
|
1172
|
+
}
|
|
1173
|
+
//#endregion
|
|
1174
|
+
//#region src/editor/selection-geometry.ts
|
|
1175
|
+
/** A plain copy of a client rectangle, the anchor shape the slash and mention menus accept as a prop. */
|
|
1176
|
+
function menuAnchorRect(rect) {
|
|
1177
|
+
if (!rect) return null;
|
|
1178
|
+
return {
|
|
1179
|
+
left: rect.left,
|
|
1180
|
+
top: rect.top,
|
|
1181
|
+
right: rect.right,
|
|
1182
|
+
bottom: rect.bottom,
|
|
1183
|
+
x: rect.x,
|
|
1184
|
+
y: rect.y,
|
|
1185
|
+
width: rect.width,
|
|
1186
|
+
height: rect.height
|
|
1187
|
+
};
|
|
1188
|
+
}
|
|
1189
|
+
function selectionElement(editor) {
|
|
1190
|
+
const { node } = editor.view.domAtPos(editor.state.selection.from);
|
|
1191
|
+
return node instanceof HTMLElement ? node : node.parentElement;
|
|
1192
|
+
}
|
|
1193
|
+
/** The rendered table that holds the selection's start. */
|
|
1194
|
+
function selectedTableElement(editor) {
|
|
1195
|
+
return selectionElement(editor)?.closest("table");
|
|
1196
|
+
}
|
|
1197
|
+
/** The rendered cell that holds the selection's start. */
|
|
1198
|
+
function selectedTableCellElement(editor) {
|
|
1199
|
+
return selectionElement(editor)?.closest("td, th");
|
|
1200
|
+
}
|
|
1201
|
+
//#endregion
|
|
1202
|
+
//#region src/editor/extensions/table-commands.ts
|
|
1203
|
+
/**
|
|
1204
|
+
* Moves the caret to the cell an overlay action names when the action comes from a table other
|
|
1205
|
+
* than the selected one, so table commands act on that table. A cell menu also selects its cell,
|
|
1206
|
+
* unless that cell is already part of the selection.
|
|
1207
|
+
*/
|
|
1208
|
+
function focusTableOverlayTarget(editor, table, detail) {
|
|
1209
|
+
const target = "rowIndex" in detail ? resolveTableCellAt(table, detail.rowIndex, detail.columnIndex) : "fromIndex" in detail ? resolveTableCellAt(table, detail.action === "reorder-row" ? detail.fromIndex : 0, detail.action === "reorder-column" ? detail.fromIndex : 0) : resolveTableCellAt(table, detail.action.startsWith("add-row") ? Math.max(0, detail.boundaryIndex - 1) : 0, detail.action.startsWith("add-column") ? Math.max(0, detail.boundaryIndex - 1) : 0);
|
|
1210
|
+
if (target && selectedTableElement(editor) !== table) editor.chain().focus().setTextSelection(editor.view.posAtDOM(target, 0) + 1).run();
|
|
1211
|
+
if (detail.action !== "open-cell-menu") return;
|
|
1212
|
+
const selected = selectedTableCellElement(editor);
|
|
1213
|
+
const cell = resolveTableCellAt(table, detail.rowIndex, detail.columnIndex) ?? selected;
|
|
1214
|
+
if (cell && selected !== cell && !cell.classList.contains("selectedCell")) editor.chain().focus().setTextSelection(editor.view.posAtDOM(cell, 0) + 1).run();
|
|
1215
|
+
else editor.commands.focus();
|
|
1216
|
+
}
|
|
1217
|
+
//#endregion
|
|
1097
1218
|
//#region src/editor/content.ts
|
|
1098
1219
|
/** Whether a controlled document already matches the editor, so applying it would only reset the selection. */
|
|
1099
1220
|
function sameDocument(left, right) {
|
|
@@ -1389,34 +1510,6 @@ function createLinkEditing(options) {
|
|
|
1389
1510
|
};
|
|
1390
1511
|
}
|
|
1391
1512
|
//#endregion
|
|
1392
|
-
//#region src/editor/selection-geometry.ts
|
|
1393
|
-
/** A plain copy of a client rectangle, the anchor shape the slash and mention menus accept as a prop. */
|
|
1394
|
-
function menuAnchorRect(rect) {
|
|
1395
|
-
if (!rect) return null;
|
|
1396
|
-
return {
|
|
1397
|
-
left: rect.left,
|
|
1398
|
-
top: rect.top,
|
|
1399
|
-
right: rect.right,
|
|
1400
|
-
bottom: rect.bottom,
|
|
1401
|
-
x: rect.x,
|
|
1402
|
-
y: rect.y,
|
|
1403
|
-
width: rect.width,
|
|
1404
|
-
height: rect.height
|
|
1405
|
-
};
|
|
1406
|
-
}
|
|
1407
|
-
function selectionElement(editor) {
|
|
1408
|
-
const { node } = editor.view.domAtPos(editor.state.selection.from);
|
|
1409
|
-
return node instanceof HTMLElement ? node : node.parentElement;
|
|
1410
|
-
}
|
|
1411
|
-
/** The rendered table that holds the selection's start. */
|
|
1412
|
-
function selectedTableElement(editor) {
|
|
1413
|
-
return selectionElement(editor)?.closest("table");
|
|
1414
|
-
}
|
|
1415
|
-
/** The rendered cell that holds the selection's start. */
|
|
1416
|
-
function selectedTableCellElement(editor) {
|
|
1417
|
-
return selectionElement(editor)?.closest("td, th");
|
|
1418
|
-
}
|
|
1419
|
-
//#endregion
|
|
1420
1513
|
//#region src/editor/selection-surface.ts
|
|
1421
1514
|
var surfaceSequence = 0;
|
|
1422
1515
|
/**
|
|
@@ -2764,7 +2857,12 @@ var LoomaEditor = defineComponent({
|
|
|
2764
2857
|
let linkEditing;
|
|
2765
2858
|
const linkState = shallowRef(LOOMA_LINK_EDITING_IDLE);
|
|
2766
2859
|
const chipAnchorId = `looma-editor-chip-${useId().replace(/[^a-zA-Z0-9_-]/g, "")}`;
|
|
2767
|
-
const
|
|
2860
|
+
const chipEditorRoot = ref(null);
|
|
2861
|
+
const setChipEditorRoot = (instance) => {
|
|
2862
|
+
const element = instance?.$el;
|
|
2863
|
+
chipEditorRoot.value = element instanceof HTMLElement ? element : null;
|
|
2864
|
+
};
|
|
2865
|
+
const chipInput = () => chipEditorRoot.value?.querySelector("[data-chip-label]");
|
|
2768
2866
|
const chipOpen = ref(false);
|
|
2769
2867
|
const chipLabel = ref("");
|
|
2770
2868
|
const chipColor = ref("neutral");
|
|
@@ -2887,7 +2985,7 @@ var LoomaEditor = defineComponent({
|
|
|
2887
2985
|
chipLabel.value = String(node.attrs.label ?? "");
|
|
2888
2986
|
chipColor.value = normalizeLoomaChipColor(node.attrs.color);
|
|
2889
2987
|
chipOpen.value = true;
|
|
2890
|
-
nextTick(() => chipInput
|
|
2988
|
+
nextTick(() => chipInput()?.focus());
|
|
2891
2989
|
};
|
|
2892
2990
|
const changeChip = (changes) => {
|
|
2893
2991
|
const instance = editor.value;
|
|
@@ -3145,32 +3243,6 @@ var LoomaEditor = defineComponent({
|
|
|
3145
3243
|
onRemove: () => linkEditing?.remove()
|
|
3146
3244
|
});
|
|
3147
3245
|
};
|
|
3148
|
-
const runBlockAction = (value) => {
|
|
3149
|
-
const instance = editor.value;
|
|
3150
|
-
const head = instance?.state.selection.$head;
|
|
3151
|
-
if (!instance || !head || head.depth === 0 || !props.editable) return;
|
|
3152
|
-
const { state } = instance;
|
|
3153
|
-
const position = head.before(1);
|
|
3154
|
-
const block = state.doc.nodeAt(position);
|
|
3155
|
-
if (!block) return;
|
|
3156
|
-
const end = position + block.nodeSize;
|
|
3157
|
-
const transaction = state.tr;
|
|
3158
|
-
let focusAt = end + 1;
|
|
3159
|
-
if (value === "insert-below") transaction.insert(end, state.schema.nodes.paragraph.create());
|
|
3160
|
-
else if (value === "duplicate") transaction.insert(end, block);
|
|
3161
|
-
else if (value === "delete") {
|
|
3162
|
-
if (state.doc.childCount === 1) {
|
|
3163
|
-
transaction.replaceWith(position, end, state.schema.nodes.paragraph.create());
|
|
3164
|
-
focusAt = 1;
|
|
3165
|
-
} else {
|
|
3166
|
-
transaction.delete(position, end);
|
|
3167
|
-
focusAt = Math.min(position + 1, transaction.doc.content.size);
|
|
3168
|
-
}
|
|
3169
|
-
} else return;
|
|
3170
|
-
transaction.setSelection(TextSelection.near(transaction.doc.resolve(Math.min(focusAt, transaction.doc.content.size))));
|
|
3171
|
-
instance.view.dispatch(transaction);
|
|
3172
|
-
instance.commands.focus();
|
|
3173
|
-
};
|
|
3174
3246
|
watch([() => props.slashCommands, () => props.uploadImage], () => {
|
|
3175
3247
|
slashExtension.options.commands = resolveSlashCommands();
|
|
3176
3248
|
editor.value?.commands.dismissLoomaSlashMenu();
|
|
@@ -3760,13 +3832,8 @@ var LoomaEditor = defineComponent({
|
|
|
3760
3832
|
if (!instance) return;
|
|
3761
3833
|
const table = overlayTableElement ?? selectedTableElement(instance);
|
|
3762
3834
|
if (!table) return;
|
|
3763
|
-
|
|
3764
|
-
if (targetCell && selectedTableElement(instance) !== table) instance.chain().focus().setTextSelection(instance.view.posAtDOM(targetCell, 0) + 1).run();
|
|
3835
|
+
focusTableOverlayTarget(instance, table, detail);
|
|
3765
3836
|
if (detail.action === "open-cell-menu") {
|
|
3766
|
-
const selectedCell = selectedTableCellElement(instance);
|
|
3767
|
-
const cell = table ? resolveTableCellAt(table, detail.rowIndex, detail.columnIndex) ?? selectedCell : selectedCell;
|
|
3768
|
-
if (cell && selectedCell !== cell && !cell.classList.contains("selectedCell")) instance.chain().focus().setTextSelection(instance.view.posAtDOM(cell, 0) + 1).run();
|
|
3769
|
-
else instance.commands.focus();
|
|
3770
3837
|
updateTableUi();
|
|
3771
3838
|
tableUi.menuScope = "cell";
|
|
3772
3839
|
tableUi.menuStyle = {
|
|
@@ -4206,46 +4273,20 @@ var LoomaEditor = defineComponent({
|
|
|
4206
4273
|
onClose: () => {
|
|
4207
4274
|
chipOpen.value = false;
|
|
4208
4275
|
}
|
|
4209
|
-
}, () => h(
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
type: "text",
|
|
4216
|
-
value: chipLabel.value,
|
|
4217
|
-
placeholder: "Set a label",
|
|
4218
|
-
"aria-label": "Chip text",
|
|
4219
|
-
onInput: (event) => {
|
|
4220
|
-
chipLabel.value = event.target.value;
|
|
4276
|
+
}, () => h(EditorChipEditor, {
|
|
4277
|
+
ref: setChipEditorRoot,
|
|
4278
|
+
label: chipLabel.value,
|
|
4279
|
+
color: chipColor.value,
|
|
4280
|
+
onLabel: (event) => {
|
|
4281
|
+
chipLabel.value = event.detail.label;
|
|
4221
4282
|
changeChip({ label: chipLabel.value });
|
|
4222
4283
|
},
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
}), h("div", {
|
|
4230
|
-
class: "looma-editor__chip-colors",
|
|
4231
|
-
role: "group",
|
|
4232
|
-
"aria-label": "Chip color"
|
|
4233
|
-
}, LOOMA_CHIP_COLORS.map((color) => h("button", {
|
|
4234
|
-
type: "button",
|
|
4235
|
-
class: "looma-editor__chip-color",
|
|
4236
|
-
"data-color": color,
|
|
4237
|
-
"aria-label": `${color[0].toUpperCase()}${color.slice(1)} chip`,
|
|
4238
|
-
"aria-pressed": chipColor.value === color,
|
|
4239
|
-
onClick: () => {
|
|
4240
|
-
if (chipColor.value === color) {
|
|
4241
|
-
chipInput.value?.focus();
|
|
4242
|
-
return;
|
|
4243
|
-
}
|
|
4244
|
-
chipColor.value = color;
|
|
4245
|
-
changeChip({ color });
|
|
4246
|
-
chipInput.value?.focus();
|
|
4247
|
-
}
|
|
4248
|
-
}, chipColor.value === color ? "✓" : "")))])),
|
|
4284
|
+
onColor: (event) => {
|
|
4285
|
+
chipColor.value = event.detail.color;
|
|
4286
|
+
changeChip({ color: event.detail.color });
|
|
4287
|
+
},
|
|
4288
|
+
onDone: () => closeChip(true)
|
|
4289
|
+
})),
|
|
4249
4290
|
h(Popover, {
|
|
4250
4291
|
class: "looma-editor__link-popover",
|
|
4251
4292
|
size: "sm",
|
|
@@ -4276,7 +4317,9 @@ var LoomaEditor = defineComponent({
|
|
|
4276
4317
|
h(EditorBlockActions, {
|
|
4277
4318
|
for: blockActionAnchorId,
|
|
4278
4319
|
placement: mobile.value ? "top-start" : "bottom-start",
|
|
4279
|
-
onAction: (event) =>
|
|
4320
|
+
onAction: (event) => {
|
|
4321
|
+
if (props.editable && editor.value) runBlockAction(editor.value, event.detail.action);
|
|
4322
|
+
}
|
|
4280
4323
|
}),
|
|
4281
4324
|
h(Popover, {
|
|
4282
4325
|
class: "looma-editor__table-picker-popover",
|
|
@@ -4407,4 +4450,4 @@ var LoomaEditor = defineComponent({
|
|
|
4407
4450
|
}
|
|
4408
4451
|
});
|
|
4409
4452
|
//#endregion
|
|
4410
|
-
export { EDITOR_ADAPTER_COMPONENT_TAG_MAP, EditorBlockActions, EditorCodeLanguage, EditorImageToolbar, EditorInsertTableGrid, EditorLinkCard, EditorLinkForm, EditorMentionMenu, EditorMentionMenuItem, EditorSlashMenu, EditorSlashMenuGroup, EditorSlashMenuItem, EditorTableContextMenu, EditorTableOverlay, EditorTableToolbar, EditorToolbar, LoomaEditor };
|
|
4453
|
+
export { EDITOR_ADAPTER_COMPONENT_TAG_MAP, EditorBlockActions, EditorChipEditor, EditorCodeLanguage, EditorImageToolbar, EditorInsertTableGrid, EditorLinkCard, EditorLinkForm, EditorMentionMenu, EditorMentionMenuItem, EditorSlashMenu, EditorSlashMenuGroup, EditorSlashMenuItem, EditorTableContextMenu, EditorTableOverlay, EditorTableToolbar, EditorToolbar, LoomaEditor };
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* `@threadlabs/looma/vue`, re-exported beside the editor that composes them.
|
|
4
4
|
*/
|
|
5
5
|
import type { InsertTableEventDetail, MentionMenuHighlightEventDetail, MentionMenuSelectEventDetail, SlashMenuHighlightEventDetail, SlashMenuSelectEventDetail, TableContextMenuActionEventDetail } from "@threadlabs/looma/editor";
|
|
6
|
-
export { EditorBlockActions, EditorCodeLanguage, EditorImageToolbar, EditorInsertTableGrid, EditorLinkCard, EditorLinkForm, EditorMentionMenu, EditorMentionMenuItem, EditorSlashMenu, EditorSlashMenuGroup, EditorSlashMenuItem, EditorTableContextMenu, EditorTableOverlay, EditorTableToolbar, EditorToolbar, } from "@threadlabs/looma/vue";
|
|
6
|
+
export { EditorBlockActions, EditorChipEditor, EditorCodeLanguage, EditorImageToolbar, EditorInsertTableGrid, EditorLinkCard, EditorLinkForm, EditorMentionMenu, EditorMentionMenuItem, EditorSlashMenu, EditorSlashMenuGroup, EditorSlashMenuItem, EditorTableContextMenu, EditorTableOverlay, EditorTableToolbar, EditorToolbar, } from "@threadlabs/looma/vue";
|
|
7
7
|
/** The editor components' event details, by event name. */
|
|
8
8
|
export interface VueEditorAdapterEventMap {
|
|
9
9
|
highlight: MentionMenuHighlightEventDetail | SlashMenuHighlightEventDetail;
|
|
@@ -39,6 +39,13 @@ export interface VueEditorAdapterEventMap {
|
|
|
39
39
|
language: {
|
|
40
40
|
value: string;
|
|
41
41
|
};
|
|
42
|
+
label: {
|
|
43
|
+
label: string;
|
|
44
|
+
};
|
|
45
|
+
color: {
|
|
46
|
+
color: "neutral" | "blue" | "green" | "yellow" | "red" | "purple";
|
|
47
|
+
};
|
|
48
|
+
done: Record<string, never>;
|
|
42
49
|
"add-row-before": {
|
|
43
50
|
boundaryIndex: number;
|
|
44
51
|
};
|
|
@@ -107,4 +114,5 @@ export declare const EDITOR_ADAPTER_COMPONENT_TAG_MAP: {
|
|
|
107
114
|
readonly EditorLinkForm: "ui-editor-link-form";
|
|
108
115
|
readonly EditorBlockActions: "ui-editor-block-actions";
|
|
109
116
|
readonly EditorCodeLanguage: "ui-editor-code-language";
|
|
117
|
+
readonly EditorChipEditor: "ui-editor-chip-editor";
|
|
110
118
|
};
|
package/vue/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export { default as Dialog } from "./UiDialog.js";
|
|
|
20
20
|
export { default as Disclosure } from "./UiDisclosure.js";
|
|
21
21
|
export { default as Editable } from "./UiEditable.js";
|
|
22
22
|
export { default as EditorBlockActions } from "./UiEditorBlockActions.js";
|
|
23
|
+
export { default as EditorChipEditor } from "./UiEditorChipEditor.js";
|
|
23
24
|
export { default as EditorCodeLanguage } from "./UiEditorCodeLanguage.js";
|
|
24
25
|
export { default as EditorImageToolbar } from "./UiEditorImageToolbar.js";
|
|
25
26
|
export { default as EditorInsertTableGrid } from "./UiEditorInsertTableGrid.js";
|
|
@@ -66,6 +67,7 @@ export { default as Sidebar } from "./UiSidebar.js";
|
|
|
66
67
|
export { default as Spinner } from "./UiSpinner.js";
|
|
67
68
|
export { default as Stack } from "./UiStack.js";
|
|
68
69
|
export { default as StatusMessage } from "./UiStatusMessage.js";
|
|
70
|
+
export { default as Swatch } from "./UiSwatch.js";
|
|
69
71
|
export { default as Switch } from "./UiSwitch.js";
|
|
70
72
|
export { default as Switcher } from "./UiSwitcher.js";
|
|
71
73
|
export { default as Table } from "./UiTable.js";
|
package/vue/index.js
CHANGED
|
@@ -26,13 +26,16 @@ import { t as UiEditable_default } from "./chunks/UiEditable.js";
|
|
|
26
26
|
import { t as UiMenu_default } from "./chunks/UiMenu.js";
|
|
27
27
|
import { t as UiMenuItem_default } from "./chunks/UiMenuItem.js";
|
|
28
28
|
import { t as UiEditorBlockActions_default } from "./chunks/UiEditorBlockActions.js";
|
|
29
|
+
import { t as UiInput_default } from "./chunks/UiInput.js";
|
|
30
|
+
import { t as UiRadioGroup_default } from "./chunks/UiRadioGroup.js";
|
|
31
|
+
import { t as UiStack_default } from "./chunks/UiStack.js";
|
|
32
|
+
import { t as UiSwatch_default } from "./chunks/UiSwatch.js";
|
|
33
|
+
import { t as UiEditorChipEditor_default } from "./chunks/UiEditorChipEditor.js";
|
|
29
34
|
import { t as UiEditorCodeLanguage_default } from "./chunks/UiEditorCodeLanguage.js";
|
|
30
35
|
import { t as UiEditorToolbar_default } from "./chunks/UiEditorToolbar.js";
|
|
31
36
|
import { t as UiFormField_default } from "./chunks/UiFormField.js";
|
|
32
37
|
import { t as UiIconButton_default } from "./chunks/UiIconButton.js";
|
|
33
|
-
import { t as UiInput_default } from "./chunks/UiInput.js";
|
|
34
38
|
import { t as UiPopover_default } from "./chunks/UiPopover.js";
|
|
35
|
-
import { t as UiStack_default } from "./chunks/UiStack.js";
|
|
36
39
|
import { t as UiText_default } from "./chunks/UiText.js";
|
|
37
40
|
import { t as UiEditorImageToolbar_default } from "./chunks/UiEditorImageToolbar.js";
|
|
38
41
|
import { t as UiEditorInsertTableGrid_default } from "./chunks/UiEditorInsertTableGrid.js";
|
|
@@ -60,7 +63,6 @@ import { t as UiMeter_default } from "./chunks/UiMeter.js";
|
|
|
60
63
|
import { t as UiNavItem_default } from "./chunks/UiNavItem.js";
|
|
61
64
|
import { t as UiPageHeader_default } from "./chunks/UiPageHeader.js";
|
|
62
65
|
import { t as UiRadio_default } from "./chunks/UiRadio.js";
|
|
63
|
-
import { t as UiRadioGroup_default } from "./chunks/UiRadioGroup.js";
|
|
64
66
|
import { t as UiReel_default } from "./chunks/UiReel.js";
|
|
65
67
|
import { t as UiSearchShell_default } from "./chunks/UiSearchShell.js";
|
|
66
68
|
import { t as UiSection_default } from "./chunks/UiSection.js";
|
|
@@ -79,4 +81,4 @@ import { t as UiTopBar_default } from "./chunks/UiTopBar.js";
|
|
|
79
81
|
import { t as UiTree_default } from "./chunks/UiTree.js";
|
|
80
82
|
import { t as UiTreeItem_default } from "./chunks/UiTreeItem.js";
|
|
81
83
|
import { trackInputModality } from "@threadlabs/looma/components/shared/input-modality.js";
|
|
82
|
-
export { UiActionBar_default as ActionBar, UiAffordanceScope_default as AffordanceScope, UiAvatar_default as Avatar, UiAvatarGroup_default as AvatarGroup, UiBadge_default as Badge, UiBreadcrumbItem_default as BreadcrumbItem, UiBreadcrumbs_default as Breadcrumbs, UiButton_default as Button, UiCallout_default as Callout, UiCard_default as Card, UiCheckbox_default as Checkbox, UiCluster_default as Cluster, UiCombobox_default as Combobox, UiContainer_default as Container, UiContextMenu_default as ContextMenu, UiCover_default as Cover, UiDescriptionItem_default as DescriptionItem, UiDescriptionList_default as DescriptionList, UiDialog_default as Dialog, UiDisclosure_default as Disclosure, UiEditable_default as Editable, UiEditorBlockActions_default as EditorBlockActions, UiEditorCodeLanguage_default as EditorCodeLanguage, UiEditorImageToolbar_default as EditorImageToolbar, UiEditorInsertTableGrid_default as EditorInsertTableGrid, UiEditorLinkCard_default as EditorLinkCard, UiEditorLinkForm_default as EditorLinkForm, UiEditorMentionMenu_default as EditorMentionMenu, UiEditorMentionMenuItem_default as EditorMentionMenuItem, UiEditorSlashMenu_default as EditorSlashMenu, UiEditorSlashMenuGroup_default as EditorSlashMenuGroup, UiEditorSlashMenuItem_default as EditorSlashMenuItem, UiEditorSurface_default as EditorSurface, UiEditorTableContextMenu_default as EditorTableContextMenu, UiEditorTableOverlay_default as EditorTableOverlay, UiEditorTableToolbar_default as EditorTableToolbar, UiEditorToolbar_default as EditorToolbar, UiFloatingActionButton_default as FloatingActionButton, UiFormField_default as FormField, UiGrid_default as Grid, UiIcon_default as Icon, UiIconButton_default as IconButton, UiImage_default as Image, UiInput_default as Input, UiInputGroup_default as InputGroup, UiList_default as List, UiListItem_default as ListItem, UiListbox_default as Listbox, UiMenu_default as Menu, UiMenuGroup_default as MenuGroup, UiMenuItem_default as MenuItem, UiMeter_default as Meter, UiNavItem_default as NavItem, UiPageHeader_default as PageHeader, UiPopover_default as Popover, UiRadio_default as Radio, UiRadioGroup_default as RadioGroup, UiReel_default as Reel, UiScrollArea_default as ScrollArea, UiSearchResultRow_default as SearchResultRow, UiSearchShell_default as SearchShell, UiSection_default as Section, UiSelect_default as Select, UiSeparator_default as Separator, UiSidebar_default as Sidebar, UiSpinner_default as Spinner, UiStack_default as Stack, UiStatusMessage_default as StatusMessage, UiSwitch_default as Switch, UiSwitcher_default as Switcher, UiTable_default as Table, UiTabs_default as Tabs, UiText_default as Text, UiTextarea_default as Textarea, UiToast_default as Toast, UiToastRegion_default as ToastRegion, UiTooltip_default as Tooltip, UiTopBar_default as TopBar, UiTree_default as Tree, UiTreeItem_default as TreeItem, trackInputModality };
|
|
84
|
+
export { UiActionBar_default as ActionBar, UiAffordanceScope_default as AffordanceScope, UiAvatar_default as Avatar, UiAvatarGroup_default as AvatarGroup, UiBadge_default as Badge, UiBreadcrumbItem_default as BreadcrumbItem, UiBreadcrumbs_default as Breadcrumbs, UiButton_default as Button, UiCallout_default as Callout, UiCard_default as Card, UiCheckbox_default as Checkbox, UiCluster_default as Cluster, UiCombobox_default as Combobox, UiContainer_default as Container, UiContextMenu_default as ContextMenu, UiCover_default as Cover, UiDescriptionItem_default as DescriptionItem, UiDescriptionList_default as DescriptionList, UiDialog_default as Dialog, UiDisclosure_default as Disclosure, UiEditable_default as Editable, UiEditorBlockActions_default as EditorBlockActions, UiEditorChipEditor_default as EditorChipEditor, UiEditorCodeLanguage_default as EditorCodeLanguage, UiEditorImageToolbar_default as EditorImageToolbar, UiEditorInsertTableGrid_default as EditorInsertTableGrid, UiEditorLinkCard_default as EditorLinkCard, UiEditorLinkForm_default as EditorLinkForm, UiEditorMentionMenu_default as EditorMentionMenu, UiEditorMentionMenuItem_default as EditorMentionMenuItem, UiEditorSlashMenu_default as EditorSlashMenu, UiEditorSlashMenuGroup_default as EditorSlashMenuGroup, UiEditorSlashMenuItem_default as EditorSlashMenuItem, UiEditorSurface_default as EditorSurface, UiEditorTableContextMenu_default as EditorTableContextMenu, UiEditorTableOverlay_default as EditorTableOverlay, UiEditorTableToolbar_default as EditorTableToolbar, UiEditorToolbar_default as EditorToolbar, UiFloatingActionButton_default as FloatingActionButton, UiFormField_default as FormField, UiGrid_default as Grid, UiIcon_default as Icon, UiIconButton_default as IconButton, UiImage_default as Image, UiInput_default as Input, UiInputGroup_default as InputGroup, UiList_default as List, UiListItem_default as ListItem, UiListbox_default as Listbox, UiMenu_default as Menu, UiMenuGroup_default as MenuGroup, UiMenuItem_default as MenuItem, UiMeter_default as Meter, UiNavItem_default as NavItem, UiPageHeader_default as PageHeader, UiPopover_default as Popover, UiRadio_default as Radio, UiRadioGroup_default as RadioGroup, UiReel_default as Reel, UiScrollArea_default as ScrollArea, UiSearchResultRow_default as SearchResultRow, UiSearchShell_default as SearchShell, UiSection_default as Section, UiSelect_default as Select, UiSeparator_default as Separator, UiSidebar_default as Sidebar, UiSpinner_default as Spinner, UiStack_default as Stack, UiStatusMessage_default as StatusMessage, UiSwatch_default as Swatch, UiSwitch_default as Switch, UiSwitcher_default as Switcher, UiTable_default as Table, UiTabs_default as Tabs, UiText_default as Text, UiTextarea_default as Textarea, UiToast_default as Toast, UiToastRegion_default as ToastRegion, UiTooltip_default as Tooltip, UiTopBar_default as TopBar, UiTree_default as Tree, UiTreeItem_default as TreeItem, trackInputModality };
|