@threadlabs/looma 0.53.2 → 0.53.4
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/EXPRESSIVE-MARKDOWN.md +27 -2
- package/components/ui-editor/ui-editor.html +1 -0
- package/components/ui-editor-image-toolbar/ui-editor-image-toolbar.html +5 -0
- package/dist/index.js +1 -1
- package/docs/catalog.json +1 -1
- package/editor/chunks/expressmark.js +11088 -179
- package/editor/chunks/extensions.js +155 -27
- package/editor/document-session.d.ts +1 -0
- package/editor/extensions/image.d.ts +7 -0
- package/editor/extensions/index.d.ts +2 -1
- package/editor/extensions/index.js +3 -3
- package/editor/extensions/line-block.d.ts +5 -0
- package/editor/image-media.d.ts +10 -0
- package/editor/image-sources.d.ts +18 -0
- package/editor/index.js +15 -46
- package/package.json +5 -3
- package/vanilla/UiEditor.js +13 -10
- package/vanilla/UiEditorImageToolbar.d.ts +1 -0
- package/vanilla/UiEditorImageToolbar.js +177 -101
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { S as splitLoomaFrontmatter, _ as LOOMA_CHIP_TONES, b as normalizeLoomaCalloutTone, d as LoomaReference, f as LoomaReferencePresentation, l as normalizeImageSources, m as referenceDisplay, o as markdownToEditorDocument, p as getReferenceDisplay, s as imageHtmlSpec, u as readPictureHtml, v as assignLoomaHeadingIds, x as normalizeLoomaChipTone, y as loomaHeadingSlug } from "./expressmark.js";
|
|
1
2
|
import { i as TABLE_CELL_BACKGROUND_PRESETS, n as resolveTableCellAt } from "./table-overlay.js";
|
|
2
|
-
import { _ as normalizeLoomaChipTone, c as LoomaReferencePresentation, g as normalizeLoomaCalloutTone, h as loomaHeadingSlug, l as getReferenceDisplay, m as assignLoomaHeadingIds, o as markdownToEditorDocument, p as LOOMA_CHIP_TONES, s as LoomaReference, u as referenceDisplay, v as splitLoomaFrontmatter } from "./expressmark.js";
|
|
3
3
|
import { a as Bold, c as Document, i as Italic, l as LoomaInputRuleHistory, n as History, o as Text$1, r as HardBreak, s as Paragraph, t as Code } from "./dist.js";
|
|
4
4
|
import { Extension, InputRule, Mark, Node as Node$1, PasteRule, callOrReturn, canInsertNode, combineTransactionSteps, escapeForRegEx, findChildren, findChildrenInRange, findParentNodeClosestToPos, getAttributes, getChangedRanges, getExtensionField, getMarksBetween, getText, getTextSerializersFromSchema, isNodeEmpty, isNodeSelection, markInputRule, markPasteRule, mergeAttributes, nodeInputRule, textInputRule, textblockTypeInputRule, wrappingInputRule } from "@tiptap/core";
|
|
5
5
|
import { NodeSelection, Plugin, PluginKey, Selection, TextSelection } from "@tiptap/pm/state";
|
|
@@ -1003,6 +1003,26 @@ var LoomaLinkDefinition = Node$1.create({
|
|
|
1003
1003
|
}
|
|
1004
1004
|
});
|
|
1005
1005
|
//#endregion
|
|
1006
|
+
//#region src/editor/extensions/line-block.ts
|
|
1007
|
+
/** A paragraph-like block whose authored line boundaries remain significant on export.
|
|
1008
|
+
* @contract Keeps line-block identity through editing, HTML parsing and Markdown export.
|
|
1009
|
+
*/
|
|
1010
|
+
var LoomaLineBlock = Node$1.create({
|
|
1011
|
+
name: "loomaLineBlock",
|
|
1012
|
+
group: "block",
|
|
1013
|
+
content: "inline*",
|
|
1014
|
+
parseHTML() {
|
|
1015
|
+
return [{ tag: "div[data-type=\"line-block\"]" }];
|
|
1016
|
+
},
|
|
1017
|
+
renderHTML({ HTMLAttributes }) {
|
|
1018
|
+
return [
|
|
1019
|
+
"div",
|
|
1020
|
+
mergeAttributes(HTMLAttributes, { "data-type": "line-block" }),
|
|
1021
|
+
0
|
|
1022
|
+
];
|
|
1023
|
+
}
|
|
1024
|
+
});
|
|
1025
|
+
//#endregion
|
|
1006
1026
|
//#region src/editor/extensions/tabs.ts
|
|
1007
1027
|
/**
|
|
1008
1028
|
* Tabs or a code group, kept whole so Looma Markdown's `::: tabs` and `::: code-group` survive
|
|
@@ -3767,7 +3787,53 @@ var Image = Node$1.create({
|
|
|
3767
3787
|
}
|
|
3768
3788
|
});
|
|
3769
3789
|
//#endregion
|
|
3790
|
+
//#region src/editor/image-media.ts
|
|
3791
|
+
/** Read the host's transient attributes without adding them to the authored document. */
|
|
3792
|
+
var imageDeliveryAttributes = (decorations) => Object.assign({}, ...decorations.map((decoration) => decoration.spec.loomaImageAttributes ?? {}));
|
|
3793
|
+
/** Projects authored choices and transient delivery onto their native source/img elements. */
|
|
3794
|
+
function createImageMedia() {
|
|
3795
|
+
const dom = document.createElement("picture");
|
|
3796
|
+
const image = document.createElement("img");
|
|
3797
|
+
dom.append(image);
|
|
3798
|
+
let sourceKey = "";
|
|
3799
|
+
let written = /* @__PURE__ */ new Set();
|
|
3800
|
+
return {
|
|
3801
|
+
dom,
|
|
3802
|
+
write(attrs, delivery) {
|
|
3803
|
+
const sources = normalizeImageSources(attrs.sources);
|
|
3804
|
+
const key = JSON.stringify(sources);
|
|
3805
|
+
if (key !== sourceKey) {
|
|
3806
|
+
for (const child of dom.querySelectorAll(":scope > source")) child.remove();
|
|
3807
|
+
for (const values of sources) {
|
|
3808
|
+
const source = document.createElement("source");
|
|
3809
|
+
for (const [name, value] of Object.entries(values)) source.setAttribute(name, String(value));
|
|
3810
|
+
dom.insertBefore(source, image);
|
|
3811
|
+
}
|
|
3812
|
+
sourceKey = key;
|
|
3813
|
+
}
|
|
3814
|
+
const next = Object.entries({
|
|
3815
|
+
src: attrs.src,
|
|
3816
|
+
alt: attrs.alt ?? "",
|
|
3817
|
+
title: attrs.title,
|
|
3818
|
+
width: attrs.width,
|
|
3819
|
+
height: attrs.height,
|
|
3820
|
+
...delivery
|
|
3821
|
+
}).filter(([, value]) => value !== void 0 && value !== null && value !== false);
|
|
3822
|
+
const names = new Set(next.map(([name]) => name));
|
|
3823
|
+
for (const name of written) if (!names.has(name)) image.removeAttribute(name);
|
|
3824
|
+
for (const [name, value] of next) {
|
|
3825
|
+
const text = value === true ? "" : String(value);
|
|
3826
|
+
if (image.getAttribute(name) !== text) image.setAttribute(name, text);
|
|
3827
|
+
}
|
|
3828
|
+
written = names;
|
|
3829
|
+
}
|
|
3830
|
+
};
|
|
3831
|
+
}
|
|
3832
|
+
//#endregion
|
|
3770
3833
|
//#region src/editor/extensions/image.ts
|
|
3834
|
+
/** Both forms use the same portable image attributes and host image controls. */
|
|
3835
|
+
var isLoomaImageName = (name) => name === "image" || name === "loomaInlineImage";
|
|
3836
|
+
var imageElement = (element) => element.tagName === "PICTURE" ? element.querySelector("img") ?? element : element;
|
|
3771
3837
|
/** Accepts only positive, integral CSS-pixel dimensions. */
|
|
3772
3838
|
function normalizeImageDimension(value) {
|
|
3773
3839
|
return typeof value === "number" && Number.isSafeInteger(value) && value > 0 ? value : void 0;
|
|
@@ -3780,31 +3846,91 @@ function normalizeImagePlacement(value) {
|
|
|
3780
3846
|
* @contract Keeps Tiptap's existing `image` name and insertion command. Delivery
|
|
3781
3847
|
* attributes stay transient; dimensions and placement survive HTML and JSON.
|
|
3782
3848
|
*/
|
|
3783
|
-
var LoomaImage = Image.extend({
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
} }
|
|
3849
|
+
var LoomaImage = Image.extend({
|
|
3850
|
+
addAttributes() {
|
|
3851
|
+
return {
|
|
3852
|
+
...this.parent?.(),
|
|
3853
|
+
src: {
|
|
3854
|
+
default: null,
|
|
3855
|
+
parseHTML: (element) => imageElement(element).getAttribute("src")
|
|
3856
|
+
},
|
|
3857
|
+
alt: {
|
|
3858
|
+
default: null,
|
|
3859
|
+
parseHTML: (element) => imageElement(element).getAttribute("alt")
|
|
3860
|
+
},
|
|
3861
|
+
title: {
|
|
3862
|
+
default: null,
|
|
3863
|
+
parseHTML: (element) => imageElement(element).getAttribute("title")
|
|
3864
|
+
},
|
|
3865
|
+
sources: {
|
|
3866
|
+
default: null,
|
|
3867
|
+
parseHTML: (element) => element.tagName === "PICTURE" ? readPictureHtml(element.outerHTML)?.sources ?? null : null,
|
|
3868
|
+
renderHTML: () => ({})
|
|
3869
|
+
},
|
|
3870
|
+
width: {
|
|
3871
|
+
default: null,
|
|
3872
|
+
parseHTML: (element) => normalizeImageDimension(Number(imageElement(element).getAttribute("width"))) ?? null,
|
|
3873
|
+
renderHTML: (attrs) => normalizeImageDimension(attrs.width) ? { width: attrs.width } : {}
|
|
3874
|
+
},
|
|
3875
|
+
height: {
|
|
3876
|
+
default: null,
|
|
3877
|
+
parseHTML: (element) => normalizeImageDimension(Number(imageElement(element).getAttribute("height"))) ?? null,
|
|
3878
|
+
renderHTML: (attrs) => normalizeImageDimension(attrs.height) ? { height: attrs.height } : {}
|
|
3879
|
+
},
|
|
3880
|
+
responsive: {
|
|
3881
|
+
default: null,
|
|
3882
|
+
parseHTML: (element) => imageElement(element).hasAttribute("data-looma-responsive") || null,
|
|
3883
|
+
renderHTML: (attrs) => attrs.responsive === true ? { "data-looma-responsive": "" } : {}
|
|
3884
|
+
},
|
|
3885
|
+
placement: {
|
|
3886
|
+
default: "block",
|
|
3887
|
+
parseHTML: (element) => normalizeImagePlacement(imageElement(element).getAttribute("data-placement")),
|
|
3888
|
+
renderHTML: (attrs) => normalizeImagePlacement(attrs.placement) === "block" ? {} : { "data-placement": normalizeImagePlacement(attrs.placement) }
|
|
3889
|
+
}
|
|
3890
|
+
};
|
|
3891
|
+
},
|
|
3892
|
+
parseHTML() {
|
|
3893
|
+
return [{
|
|
3894
|
+
tag: "picture",
|
|
3895
|
+
getAttrs: (element) => readPictureHtml(element.outerHTML) ?? false
|
|
3896
|
+
}, ...this.parent?.() ?? []];
|
|
3897
|
+
},
|
|
3898
|
+
renderHTML({ node, HTMLAttributes }) {
|
|
3899
|
+
if (!node.attrs.sources && this.name === "image") return ["img", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
|
|
3900
|
+
return imageHtmlSpec(node.attrs, this.name === "loomaInlineImage");
|
|
3901
|
+
}
|
|
3902
|
+
});
|
|
3903
|
+
/** Imported inline images retain their text position.
|
|
3904
|
+
* @contract Uses the same durable attributes as a block image without overriding its insertion command.
|
|
3905
|
+
*/
|
|
3906
|
+
var LoomaInlineImage = LoomaImage.extend({
|
|
3907
|
+
name: "loomaInlineImage",
|
|
3908
|
+
priority: 1100,
|
|
3909
|
+
parseHTML() {
|
|
3910
|
+
return [{
|
|
3911
|
+
tag: "picture[data-looma-inline-image]",
|
|
3912
|
+
getAttrs: (element) => readPictureHtml(element.outerHTML) ?? false
|
|
3913
|
+
}, { tag: "img[data-looma-inline-image]" }];
|
|
3914
|
+
},
|
|
3915
|
+
addCommands: () => ({}),
|
|
3916
|
+
addInputRules: () => [],
|
|
3917
|
+
addNodeView() {
|
|
3918
|
+
return ({ node, decorations }) => {
|
|
3919
|
+
const media = createImageMedia();
|
|
3920
|
+
media.dom.setAttribute("data-looma-inline-image", "");
|
|
3921
|
+
media.write(node.attrs, imageDeliveryAttributes(decorations));
|
|
3922
|
+
return {
|
|
3923
|
+
dom: media.dom,
|
|
3924
|
+
update(next, nextDecorations) {
|
|
3925
|
+
if (next.type !== node.type) return false;
|
|
3926
|
+
media.write(next.attrs, imageDeliveryAttributes(nextDecorations));
|
|
3927
|
+
return true;
|
|
3928
|
+
},
|
|
3929
|
+
ignoreMutation: (mutation) => mutation.type !== "selection"
|
|
3930
|
+
};
|
|
3931
|
+
};
|
|
3932
|
+
}
|
|
3933
|
+
}).configure({ inline: true });
|
|
3808
3934
|
//#endregion
|
|
3809
3935
|
//#region ../../node_modules/.pnpm/@tiptap+extension-highlight@2.27.2_@tiptap+core@2.27.2_@tiptap+pm@2.27.2_/node_modules/@tiptap/extension-highlight/dist/index.js
|
|
3810
3936
|
/**
|
|
@@ -10299,6 +10425,8 @@ function getDefaultEditorExtensions(options = {}) {
|
|
|
10299
10425
|
return [
|
|
10300
10426
|
Document,
|
|
10301
10427
|
Paragraph,
|
|
10428
|
+
LoomaInlineImage,
|
|
10429
|
+
LoomaLineBlock,
|
|
10302
10430
|
Text$1,
|
|
10303
10431
|
LoomaReference,
|
|
10304
10432
|
LoomaReferencePresentation.configure({
|
|
@@ -11393,4 +11521,4 @@ function createLoomaSlashCommandExtension(options = {}) {
|
|
|
11393
11521
|
});
|
|
11394
11522
|
}
|
|
11395
11523
|
//#endregion
|
|
11396
|
-
export {
|
|
11524
|
+
export { LoomaFootnote as $, createLoomaMentionExtension as A, createImageMedia as B, getActiveTableCellBackground as C, createSiteRelativeLinks as D, LoomaSmartPaste as E, LoomaImage as F, normalizeTableOfContentsConfig as G, LoomaTableOfContents as H, LoomaInlineImage as I, LoomaTabs as J, tableOfContentsTree as K, isLoomaImageName as L, MAX_MENTION_RESULT_LIMIT as M, filterLoomaMentionItems as N, siteRelativeHref as O, normalizeMentionResultLimit as P, LOOMA_FOOTNOTE_LABEL as Q, normalizeImageDimension as R, getActiveTableCellAlignment as S, setActiveTableCellBackground as T, getTableOfContentsEntries as U, imageDeliveryAttributes as V, navigateTableOfContents as W, LoomaLinkDefinition as X, LoomaLineBlock as Y, LOOMA_FOOTNOTE_INSERTED as Z, getDefaultEditorExtensions as _, NO_TABLE_CAPABILITIES as a, revealLoomaExpandAt as at, LoomaTableCell as b, handleTableAction as c, normalizeLoomaChipColor as ct, normalizeActiveTableColumnWidths as d, LOOMA_ACTIVE_BLOCK_CLASS as dt, LoomaFootnoteReference as et, shouldShowTextFormattingToolbar as f, LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS as ft, LoomaTableKit as g, selectedTableElement as h, getDefaultSlashCommands as i, LoomaExpand as it, DEFAULT_MENTION_RESULT_LIMIT as j, LoomaMentionSuggestionPluginKey as k, handleTableOverlayAction as l, LoomaCallout as lt, selectedTableCellElement as m, LoomaActiveBlockPluginKey as mt, createLoomaSlashCommandExtension as n, LoomaFigcaption as nt, focusTableOverlayTarget as o, LOOMA_CHIP_COLORS as ot, menuAnchorRect as p, LoomaActiveBlock as pt, LoomaTab as q, filterLoomaSlashCommands as r, LoomaFigure as rt, getActiveTableUiState as s, LoomaChip as st, LoomaSlashCommand as t, findLoomaFootnote as tt, insertTableAtRange as u, LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS as ut, getLoomaTableExtensions as v, setActiveTableCellAlignment as w, LoomaTableHeader as x, LoomaTable as y, normalizeImagePlacement as z };
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { type AnyExtension } from "@tiptap/core";
|
|
2
|
+
export { imageSourceUrls, normalizeImageSources, type LoomaImageSource } from "../image-sources.js";
|
|
3
|
+
/** Both forms use the same portable image attributes and host image controls. */
|
|
4
|
+
export declare const isLoomaImageName: (name: string | undefined) => name is "image" | "loomaInlineImage";
|
|
2
5
|
/** Durable image placement; wrapping applies to block images in reading content. */
|
|
3
6
|
export type LoomaImagePlacement = "block" | "center" | "wrap-left" | "wrap-right";
|
|
4
7
|
/** Accepts only positive, integral CSS-pixel dimensions. */
|
|
@@ -10,3 +13,7 @@ export declare function normalizeImagePlacement(value: unknown): LoomaImagePlace
|
|
|
10
13
|
* attributes stay transient; dimensions and placement survive HTML and JSON.
|
|
11
14
|
*/
|
|
12
15
|
export declare const LoomaImage: AnyExtension;
|
|
16
|
+
/** Imported inline images retain their text position.
|
|
17
|
+
* @contract Uses the same durable attributes as a block image without overriding its insertion command.
|
|
18
|
+
*/
|
|
19
|
+
export declare const LoomaInlineImage: AnyExtension;
|
|
@@ -13,6 +13,7 @@ export { LoomaExpand, revealLoomaExpandAt, type LoomaExpandAttributes } from "./
|
|
|
13
13
|
export { LoomaFigcaption, LoomaFigure } from "./figure.js";
|
|
14
14
|
export { findLoomaFootnote, LOOMA_FOOTNOTE_LABEL, LoomaFootnote, LoomaFootnoteReference } from "./footnote.js";
|
|
15
15
|
export { LoomaLinkDefinition } from "./link-definition.js";
|
|
16
|
+
export { LoomaLineBlock } from "./line-block.js";
|
|
16
17
|
export { LoomaTab, LoomaTabs } from "./tabs.js";
|
|
17
18
|
export { LoomaTableOfContents, getTableOfContentsEntries, normalizeTableOfContentsConfig, type LoomaTableOfContentsConfig, type LoomaTableOfContentsEntry, type LoomaTableOfContentsFormat, } from "./table-of-contents.js";
|
|
18
19
|
export { getDefaultEditorExtensions, getLoomaTableExtensions, LoomaTableKit, type DefaultEditorExtensionsOptions, type LoomaCodeLanguages, } from "./preset.js";
|
|
@@ -23,4 +24,4 @@ export { LoomaTable, getActiveTableCellAlignment, getActiveTableCellBackground,
|
|
|
23
24
|
export { createLoomaMentionExtension, DEFAULT_MENTION_RESULT_LIMIT, filterLoomaMentionItems, LoomaMentionSuggestionPluginKey, MAX_MENTION_RESULT_LIMIT, normalizeMentionResultLimit, type LoomaMentionItem, type LoomaMentionMenuSnapshot, type LoomaMentionOptions, type LoomaMentionProvider, type LoomaMentionProviderContext, } from "./mention.js";
|
|
24
25
|
export { createLoomaSlashCommandExtension, getDefaultSlashCommands, filterLoomaSlashCommands, LoomaSlashCommand, type LoomaSlashCommand as LoomaSlashCommandItem, type LoomaSlashCommandContext, type LoomaSlashCommandOptions, type LoomaSlashMenuSnapshot, } from "./slash-command.js";
|
|
25
26
|
export { siteRelativeHref, createSiteRelativeLinks } from "./relative-links.js";
|
|
26
|
-
export { LoomaImage, normalizeImageDimension, normalizeImagePlacement, type LoomaImagePlacement } from "./image.js";
|
|
27
|
+
export { LoomaImage, LoomaInlineImage, imageSourceUrls, normalizeImageSources, normalizeImageDimension, normalizeImagePlacement, type LoomaImagePlacement, type LoomaImageSource } from "./image.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
import { c as imageSourceUrls, d as LoomaReference, f as LoomaReferencePresentation, g as LOOMA_CALLOUT_TONES, h as setReferenceDisplay, l as normalizeImageSources, m as referenceDisplay, p as getReferenceDisplay } from "../chunks/expressmark.js";
|
|
1
2
|
import { i as TABLE_CELL_BACKGROUND_PRESETS } from "../chunks/table-overlay.js";
|
|
2
|
-
import { $ as
|
|
3
|
-
|
|
4
|
-
export { DEFAULT_MENTION_RESULT_LIMIT, LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS, LOOMA_ACTIVE_BLOCK_CLASS, LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS, LOOMA_CALLOUT_TONES, LOOMA_CHIP_COLORS, LOOMA_FOOTNOTE_LABEL, LoomaActiveBlock, LoomaActiveBlockPluginKey, LoomaCallout, LoomaChip, LoomaExpand, LoomaFigcaption, LoomaFigure, LoomaFootnote, LoomaFootnoteReference, LoomaImage, LoomaLinkDefinition, LoomaMentionSuggestionPluginKey, LoomaReference, LoomaReferencePresentation, LoomaSlashCommand, LoomaSmartPaste, LoomaTab, LoomaTable, LoomaTableCell, LoomaTableHeader, LoomaTableKit, LoomaTableOfContents, LoomaTabs, MAX_MENTION_RESULT_LIMIT, TABLE_CELL_BACKGROUND_PRESETS, createLoomaMentionExtension, createLoomaSlashCommandExtension, createSiteRelativeLinks, filterLoomaMentionItems, filterLoomaSlashCommands, findLoomaFootnote, getActiveTableCellAlignment, getActiveTableCellBackground, getActiveTableUiState, getDefaultEditorExtensions, getDefaultSlashCommands, getLoomaTableExtensions, getReferenceDisplay, getTableOfContentsEntries, handleTableAction, handleTableOverlayAction, insertTableAtRange, normalizeActiveTableColumnWidths, normalizeImageDimension, normalizeImagePlacement, normalizeLoomaChipColor, normalizeMentionResultLimit, normalizeTableOfContentsConfig, referenceDisplay, revealLoomaExpandAt, setActiveTableCellAlignment, setActiveTableCellBackground, setReferenceDisplay, shouldShowTextFormattingToolbar, siteRelativeHref };
|
|
3
|
+
import { $ as LoomaFootnote, A as createLoomaMentionExtension, C as getActiveTableCellBackground, D as createSiteRelativeLinks, E as LoomaSmartPaste, F as LoomaImage, G as normalizeTableOfContentsConfig, H as LoomaTableOfContents, I as LoomaInlineImage, J as LoomaTabs, M as MAX_MENTION_RESULT_LIMIT, N as filterLoomaMentionItems, O as siteRelativeHref, P as normalizeMentionResultLimit, Q as LOOMA_FOOTNOTE_LABEL, R as normalizeImageDimension, S as getActiveTableCellAlignment, T as setActiveTableCellBackground, U as getTableOfContentsEntries, X as LoomaLinkDefinition, Y as LoomaLineBlock, _ as getDefaultEditorExtensions, at as revealLoomaExpandAt, b as LoomaTableCell, c as handleTableAction, ct as normalizeLoomaChipColor, d as normalizeActiveTableColumnWidths, dt as LOOMA_ACTIVE_BLOCK_CLASS, et as LoomaFootnoteReference, f as shouldShowTextFormattingToolbar, ft as LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS, g as LoomaTableKit, i as getDefaultSlashCommands, it as LoomaExpand, j as DEFAULT_MENTION_RESULT_LIMIT, k as LoomaMentionSuggestionPluginKey, l as handleTableOverlayAction, lt as LoomaCallout, mt as LoomaActiveBlockPluginKey, n as createLoomaSlashCommandExtension, nt as LoomaFigcaption, ot as LOOMA_CHIP_COLORS, pt as LoomaActiveBlock, q as LoomaTab, r as filterLoomaSlashCommands, rt as LoomaFigure, s as getActiveTableUiState, st as LoomaChip, t as LoomaSlashCommand, tt as findLoomaFootnote, u as insertTableAtRange, ut as LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS, v as getLoomaTableExtensions, w as setActiveTableCellAlignment, x as LoomaTableHeader, y as LoomaTable, z as normalizeImagePlacement } from "../chunks/extensions.js";
|
|
4
|
+
export { DEFAULT_MENTION_RESULT_LIMIT, LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS, LOOMA_ACTIVE_BLOCK_CLASS, LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS, LOOMA_CALLOUT_TONES, LOOMA_CHIP_COLORS, LOOMA_FOOTNOTE_LABEL, LoomaActiveBlock, LoomaActiveBlockPluginKey, LoomaCallout, LoomaChip, LoomaExpand, LoomaFigcaption, LoomaFigure, LoomaFootnote, LoomaFootnoteReference, LoomaImage, LoomaInlineImage, LoomaLineBlock, LoomaLinkDefinition, LoomaMentionSuggestionPluginKey, LoomaReference, LoomaReferencePresentation, LoomaSlashCommand, LoomaSmartPaste, LoomaTab, LoomaTable, LoomaTableCell, LoomaTableHeader, LoomaTableKit, LoomaTableOfContents, LoomaTabs, MAX_MENTION_RESULT_LIMIT, TABLE_CELL_BACKGROUND_PRESETS, createLoomaMentionExtension, createLoomaSlashCommandExtension, createSiteRelativeLinks, filterLoomaMentionItems, filterLoomaSlashCommands, findLoomaFootnote, getActiveTableCellAlignment, getActiveTableCellBackground, getActiveTableUiState, getDefaultEditorExtensions, getDefaultSlashCommands, getLoomaTableExtensions, getReferenceDisplay, getTableOfContentsEntries, handleTableAction, handleTableOverlayAction, imageSourceUrls, insertTableAtRange, normalizeActiveTableColumnWidths, normalizeImageDimension, normalizeImagePlacement, normalizeImageSources, normalizeLoomaChipColor, normalizeMentionResultLimit, normalizeTableOfContentsConfig, referenceDisplay, revealLoomaExpandAt, setActiveTableCellAlignment, setActiveTableCellBackground, setReferenceDisplay, shouldShowTextFormattingToolbar, siteRelativeHref };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Node } from "@tiptap/core";
|
|
2
|
+
/** A paragraph-like block whose authored line boundaries remain significant on export.
|
|
3
|
+
* @contract Keeps line-block identity through editing, HTML parsing and Markdown export.
|
|
4
|
+
*/
|
|
5
|
+
export declare const LoomaLineBlock: Node<any, any>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Decoration } from "@tiptap/pm/view";
|
|
2
|
+
type Attributes = Record<string, unknown>;
|
|
3
|
+
/** Read the host's transient attributes without adding them to the authored document. */
|
|
4
|
+
export declare const imageDeliveryAttributes: (decorations: readonly Decoration[]) => Attributes;
|
|
5
|
+
/** Projects authored choices and transient delivery onto their native source/img elements. */
|
|
6
|
+
export declare function createImageMedia(): {
|
|
7
|
+
dom: HTMLPictureElement;
|
|
8
|
+
write(attrs: Attributes, delivery: Attributes): void;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { DOMOutputSpec } from "@tiptap/pm/model";
|
|
2
|
+
/** Authored image choices are durable content, independent of host delivery renditions. */
|
|
3
|
+
export interface LoomaImageSource {
|
|
4
|
+
srcset: string;
|
|
5
|
+
media?: string;
|
|
6
|
+
type?: string;
|
|
7
|
+
width?: number;
|
|
8
|
+
height?: number;
|
|
9
|
+
}
|
|
10
|
+
/** Validate every candidate with the maintained srcset parser and documentation URL profile. */
|
|
11
|
+
export declare function normalizeImageSources(value: unknown): LoomaImageSource[];
|
|
12
|
+
/** All authored alternatives, for host authorization and asset rewriting. */
|
|
13
|
+
export declare function imageSourceUrls(value: unknown): string[];
|
|
14
|
+
/** Read one safe native picture without reducing its sources to the fallback image. */
|
|
15
|
+
export declare function readPictureHtml(value: string): Record<string, unknown> | null;
|
|
16
|
+
/** Native image markup shared by HTML serialization and Markdown interchange. */
|
|
17
|
+
export declare function imageHtmlSpec(attrs: Record<string, unknown>, inline?: boolean): DOMOutputSpec;
|
|
18
|
+
export declare function pictureHtml(attrs: Record<string, unknown>, inline?: boolean): string;
|
package/editor/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { C as __exportAll, c as imageSourceUrls, d as LoomaReference, f as LoomaReferencePresentation, g as LOOMA_CALLOUT_TONES, h as setReferenceDisplay, l as normalizeImageSources, m as referenceDisplay, p as getReferenceDisplay } from "./chunks/expressmark.js";
|
|
1
2
|
import { i as TABLE_CELL_BACKGROUND_PRESETS, n as resolveTableCellAt, r as TABLE_CELL_BACKGROUND_OPTIONS, t as measureTableOverlayGeometry } from "./chunks/table-overlay.js";
|
|
2
3
|
import "./ui.js";
|
|
3
|
-
import { $ as
|
|
4
|
-
import { c as LoomaReferencePresentation, d as setReferenceDisplay, f as LOOMA_CALLOUT_TONES, l as getReferenceDisplay, s as LoomaReference, u as referenceDisplay } from "./chunks/expressmark.js";
|
|
4
|
+
import { $ as LoomaFootnote, A as createLoomaMentionExtension, B as createImageMedia, C as getActiveTableCellBackground, D as createSiteRelativeLinks, E as LoomaSmartPaste, F as LoomaImage, G as normalizeTableOfContentsConfig, H as LoomaTableOfContents, I as LoomaInlineImage, J as LoomaTabs, K as tableOfContentsTree, L as isLoomaImageName, M as MAX_MENTION_RESULT_LIMIT, N as filterLoomaMentionItems, O as siteRelativeHref, P as normalizeMentionResultLimit, Q as LOOMA_FOOTNOTE_LABEL, R as normalizeImageDimension, S as getActiveTableCellAlignment, T as setActiveTableCellBackground, U as getTableOfContentsEntries, V as imageDeliveryAttributes, W as navigateTableOfContents, X as LoomaLinkDefinition, Y as LoomaLineBlock, Z as LOOMA_FOOTNOTE_INSERTED, _ as getDefaultEditorExtensions, a as NO_TABLE_CAPABILITIES, at as revealLoomaExpandAt, b as LoomaTableCell, c as handleTableAction, ct as normalizeLoomaChipColor, d as normalizeActiveTableColumnWidths, dt as LOOMA_ACTIVE_BLOCK_CLASS, et as LoomaFootnoteReference, f as shouldShowTextFormattingToolbar, ft as LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS, g as LoomaTableKit, h as selectedTableElement, i as getDefaultSlashCommands, it as LoomaExpand, j as DEFAULT_MENTION_RESULT_LIMIT, k as LoomaMentionSuggestionPluginKey, l as handleTableOverlayAction, lt as LoomaCallout, m as selectedTableCellElement, mt as LoomaActiveBlockPluginKey, n as createLoomaSlashCommandExtension, nt as LoomaFigcaption, o as focusTableOverlayTarget, ot as LOOMA_CHIP_COLORS, p as menuAnchorRect, pt as LoomaActiveBlock, q as LoomaTab, r as filterLoomaSlashCommands, rt as LoomaFigure, s as getActiveTableUiState, st as LoomaChip, t as LoomaSlashCommand, tt as findLoomaFootnote, u as insertTableAtRange, ut as LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS, v as getLoomaTableExtensions, w as setActiveTableCellAlignment, x as LoomaTableHeader, y as LoomaTable, z as normalizeImagePlacement } from "./chunks/extensions.js";
|
|
5
5
|
import { n as validLinkHref } from "./chunks/content.js";
|
|
6
6
|
import { n as selectionSnapshot, t as createEditorSession } from "./chunks/session.js";
|
|
7
7
|
import { Extension, isNodeSelection, posToDOMRect } from "@tiptap/core";
|
|
@@ -13,18 +13,6 @@ import { createLowlight } from "lowlight";
|
|
|
13
13
|
import { AlignCenter, AlignLeft, AlignRight, ArrowLeft, Bell, Bold, BookUser, Braces, Calculator, CalendarDays, Check, ChevronDown, ChevronLeft, ChevronRight, CircleCheck, CircleDot, CircleQuestionMark, CircleX, Clock, CodeXml, Columns3, Compass, CreditCard, Ellipsis, Eraser, ExternalLink, FileText, Folder, GripHorizontal, GripVertical, Heading1, Heading2, Heading3, Highlighter, History, Image, Info, Italic, LayoutDashboard, Lightbulb, Link, List, ListOrdered, ListTodo, LoaderCircle, Menu, Merge, MessageSquareWarning, Minus, Monitor, Moon, NotebookPen, PaintBucket, PanelBottom, PanelLeft, PanelRight, PanelTop, Paperclip, Pencil, Pilcrow, Plus, Quote, Receipt, Redo2, Rows3, Search, Settings, Slash, Split, Strikethrough, Sun, Superscript, Table2, Tag, Trash2, TriangleAlert, Truck, Underline, Undo2, Unlink, UserRound, Users, X } from "lucide";
|
|
14
14
|
import { componentRegistry } from "@nextwebwg/html-next/runtime";
|
|
15
15
|
import { IndexedList, NONCONFORMING, READY_INPUT, UNRESOLVED_INPUT, acceptProps, activateModule, armElement, attachGeneratedController, awaitInput, buildTemplate, checkBoolean, checkConstrained, checkFormat, checkInteger, checkList, checkNumber, checkObject, checkString, checkedReferenceValue, clearRegion, computedCycle, defineComponent, detailCheck, dispatchDeclared, dispose, equalValue, evaluateInput, fillSlot, formatOf, forwardAttributes, generatedInputs, hostState, initializeSlot, inputRead, keywordFormat, manageProps, notifyPropertySet, project, readIndex, readMember, readonlyView, readsChanged, rec, recordValue, replaceRoot, resetForwardedAttributes, sharePlainSlots, textCall, toAttribute, toText, trackContainer, truthy, writeAttribute, writeUrlAttribute } from "@nextwebwg/html-next/generated-runtime";
|
|
16
|
-
//#region \0rolldown/runtime.js
|
|
17
|
-
var __defProp = Object.defineProperty;
|
|
18
|
-
var __exportAll = (all, no_symbols) => {
|
|
19
|
-
let target = {};
|
|
20
|
-
for (var name in all) __defProp(target, name, {
|
|
21
|
-
get: all[name],
|
|
22
|
-
enumerable: true
|
|
23
|
-
});
|
|
24
|
-
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
25
|
-
return target;
|
|
26
|
-
};
|
|
27
|
-
//#endregion
|
|
28
16
|
//#region src/editor/icons.ts
|
|
29
17
|
/** The opinionated Lucide set used by Looma's shipped interaction surfaces. */
|
|
30
18
|
var LOOMA_ICONS = {
|
|
@@ -924,7 +912,7 @@ function createDecorations(doc, resolveSource, resolver, failedRenditions, edita
|
|
|
924
912
|
const decorations = [];
|
|
925
913
|
const currentSources = /* @__PURE__ */ new Set();
|
|
926
914
|
doc.descendants((node, position) => {
|
|
927
|
-
if (node.type.name
|
|
915
|
+
if (!isLoomaImageName(node.type.name)) return;
|
|
928
916
|
const image = imageDescriptorFromAttrs(node.attrs);
|
|
929
917
|
if (!image) return;
|
|
930
918
|
currentSources.add(image.src);
|
|
@@ -938,7 +926,7 @@ function rangeContainsImage(doc, from, to) {
|
|
|
938
926
|
const end = Math.max(start, Math.min(to + 1, doc.content.size));
|
|
939
927
|
let found = false;
|
|
940
928
|
doc.nodesBetween(start, end, (node) => {
|
|
941
|
-
if (node.type.name
|
|
929
|
+
if (!isLoomaImageName(node.type.name)) return !found;
|
|
942
930
|
found = true;
|
|
943
931
|
return false;
|
|
944
932
|
});
|
|
@@ -14919,8 +14907,6 @@ defineComponent("ui-image", createUiImage, [
|
|
|
14919
14907
|
]);
|
|
14920
14908
|
//#endregion
|
|
14921
14909
|
//#region src/editor/node-views/image.ts
|
|
14922
|
-
/** The delivery attributes the editor's decorations lay over the stored ones, such as `srcset`. */
|
|
14923
|
-
var deliveryAttributes = (decorations) => Object.assign({}, ...decorations.map((decoration) => decoration.spec.loomaImageAttributes ?? {}));
|
|
14924
14910
|
/**
|
|
14925
14911
|
* Projects Image's resize into one document transaction, and draws the stored image with the
|
|
14926
14912
|
* delivery attributes laid over it.
|
|
@@ -14931,27 +14917,9 @@ var deliveryAttributes = (decorations) => Object.assign({}, ...decorations.map((
|
|
|
14931
14917
|
*/
|
|
14932
14918
|
var imageNodeView = ({ editor, node, getPos, decorations }) => {
|
|
14933
14919
|
let current = node;
|
|
14934
|
-
let delivery =
|
|
14920
|
+
let delivery = imageDeliveryAttributes(decorations);
|
|
14935
14921
|
let selected = false;
|
|
14936
|
-
const media =
|
|
14937
|
-
let written = /* @__PURE__ */ new Set();
|
|
14938
|
-
const writeMedia = (attrs) => {
|
|
14939
|
-
const next = Object.entries({
|
|
14940
|
-
src: attrs.src,
|
|
14941
|
-
alt: attrs.alt ?? "",
|
|
14942
|
-
title: attrs.title,
|
|
14943
|
-
width: attrs.width,
|
|
14944
|
-
height: attrs.height,
|
|
14945
|
-
...delivery
|
|
14946
|
-
}).filter(([, value]) => value !== void 0 && value !== null && value !== false);
|
|
14947
|
-
const names = new Set(next.map(([name]) => name));
|
|
14948
|
-
for (const name of written) if (!names.has(name)) media.removeAttribute(name);
|
|
14949
|
-
for (const [name, value] of next) {
|
|
14950
|
-
const text = value === true ? "" : String(value);
|
|
14951
|
-
if (media.getAttribute(name) !== text) media.setAttribute(name, text);
|
|
14952
|
-
}
|
|
14953
|
-
written = names;
|
|
14954
|
-
};
|
|
14922
|
+
const media = createImageMedia();
|
|
14955
14923
|
const props = (next) => ({
|
|
14956
14924
|
src: delivery.src ?? next.attrs.src,
|
|
14957
14925
|
alt: next.attrs.alt ?? "",
|
|
@@ -14961,18 +14929,18 @@ var imageNodeView = ({ editor, node, getPos, decorations }) => {
|
|
|
14961
14929
|
selected: editor.isEditable && selected,
|
|
14962
14930
|
resizable: editor.isEditable
|
|
14963
14931
|
});
|
|
14964
|
-
|
|
14932
|
+
media.write(node.attrs, delivery);
|
|
14965
14933
|
const image = createUiImage({
|
|
14966
14934
|
...props(node),
|
|
14967
14935
|
attributes: {
|
|
14968
14936
|
contenteditable: "false",
|
|
14969
14937
|
"data-looma-image-node": ""
|
|
14970
14938
|
},
|
|
14971
|
-
slots: { media: [media] }
|
|
14939
|
+
slots: { media: [media.dom] }
|
|
14972
14940
|
});
|
|
14973
14941
|
const dom = element(image);
|
|
14974
14942
|
const render = () => {
|
|
14975
|
-
|
|
14943
|
+
media.write(current.attrs, delivery);
|
|
14976
14944
|
componentRegistry.update(dom, props(current));
|
|
14977
14945
|
};
|
|
14978
14946
|
dom.addEventListener("click", (event) => {
|
|
@@ -15001,7 +14969,7 @@ var imageNodeView = ({ editor, node, getPos, decorations }) => {
|
|
|
15001
14969
|
update(next, nextDecorations) {
|
|
15002
14970
|
if (next.type !== current.type) return false;
|
|
15003
14971
|
current = next;
|
|
15004
|
-
delivery =
|
|
14972
|
+
delivery = imageDeliveryAttributes(nextDecorations);
|
|
15005
14973
|
render();
|
|
15006
14974
|
return true;
|
|
15007
14975
|
},
|
|
@@ -15869,7 +15837,7 @@ function createDocumentEditorSession(props, options) {
|
|
|
15869
15837
|
}));
|
|
15870
15838
|
const imageTargets = /* @__PURE__ */ new WeakMap();
|
|
15871
15839
|
let imageTargetSequence = 0;
|
|
15872
|
-
const selectedImage = (instance) => instance.state.selection instanceof NodeSelection && instance.state.selection.node.type.name
|
|
15840
|
+
const selectedImage = (instance) => instance.state.selection instanceof NodeSelection && isLoomaImageName(instance.state.selection.node.type.name) ? instance.state.selection : null;
|
|
15873
15841
|
const updateSelectedImage = (instance, attrs) => {
|
|
15874
15842
|
const selection = selectedImage(instance);
|
|
15875
15843
|
if (!selection || !instance.isEditable) return;
|
|
@@ -15886,7 +15854,7 @@ function createDocumentEditorSession(props, options) {
|
|
|
15886
15854
|
element,
|
|
15887
15855
|
pluginKey: "looma-image-actions",
|
|
15888
15856
|
updateDelay: 250,
|
|
15889
|
-
shouldShow: ({ editor: menuEditor }) => menuEditor.isEditable && menuEditor.state.selection instanceof NodeSelection && menuEditor.state.selection.node.type.name
|
|
15857
|
+
shouldShow: ({ editor: menuEditor }) => menuEditor.isEditable && menuEditor.state.selection instanceof NodeSelection && isLoomaImageName(menuEditor.state.selection.node.type.name),
|
|
15890
15858
|
anchor: () => {
|
|
15891
15859
|
const dom = instance.view.nodeDOM(instance.state.selection.from);
|
|
15892
15860
|
return (dom instanceof Element ? dom.querySelector("img") ?? dom : instance.view.dom).getBoundingClientRect();
|
|
@@ -15915,7 +15883,7 @@ function createDocumentEditorSession(props, options) {
|
|
|
15915
15883
|
const frame = element.closest("[data-looma-image-node]");
|
|
15916
15884
|
const position = frame?.parentNode ? instance.view.posAtDOM(frame.parentNode, Array.from(frame.parentNode.childNodes).indexOf(frame)) : instance.view.posAtDOM(element, 0);
|
|
15917
15885
|
const node = instance.state.doc.nodeAt(position);
|
|
15918
|
-
return node?.type.name
|
|
15886
|
+
return isLoomaImageName(node?.type.name) && node ? imageDescriptorFromAttrs(node.attrs) : null;
|
|
15919
15887
|
} catch {
|
|
15920
15888
|
return null;
|
|
15921
15889
|
}
|
|
@@ -16392,6 +16360,7 @@ function createDocumentEditorSession(props, options) {
|
|
|
16392
16360
|
content: uiState.footnoteState.note
|
|
16393
16361
|
},
|
|
16394
16362
|
image: {
|
|
16363
|
+
inline: image?.type.name === "loomaInlineImage",
|
|
16395
16364
|
placement: normalizeImagePlacement(image?.attrs.placement),
|
|
16396
16365
|
alt: image?.attrs.alt ?? "",
|
|
16397
16366
|
target: imageTarget
|
|
@@ -16876,4 +16845,4 @@ function createToolbarTooltip(onChange, delay = () => 400) {
|
|
|
16876
16845
|
};
|
|
16877
16846
|
}
|
|
16878
16847
|
//#endregion
|
|
16879
|
-
export { DEFAULT_MENTION_RESULT_LIMIT, LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS, LOOMA_ACTIVE_BLOCK_CLASS, LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS, LOOMA_CALLOUT_TONES, LOOMA_CHIP_COLORS, LOOMA_FOOTNOTE_LABEL, LOOMA_ICONS, LoomaActiveBlock, LoomaActiveBlockPluginKey, LoomaCallout, LoomaChip, LoomaExpand, LoomaFigcaption, LoomaFigure, LoomaFootnote, LoomaFootnoteReference, LoomaImage, LoomaLinkDefinition, LoomaMentionSuggestionPluginKey, LoomaReference, LoomaReferencePresentation, LoomaSlashCommand, LoomaSmartPaste, LoomaTab, LoomaTable, LoomaTableCell, LoomaTableHeader, LoomaTableKit, LoomaTableOfContents, LoomaTabs, MAX_MENTION_RESULT_LIMIT, TABLE_CELL_BACKGROUND_OPTIONS, TABLE_CELL_BACKGROUND_PRESETS, createDocumentEditorSession, createLoomaMentionExtension, createLoomaSlashCommandExtension, createSiteRelativeLinks, createToolbarTooltip, filterLoomaMentionItems, filterLoomaSlashCommands, findLoomaFootnote, getActiveTableCellAlignment, getActiveTableCellBackground, getActiveTableUiState, getDefaultEditorExtensions, getDefaultSlashCommands, getLoomaTableExtensions, getReferenceDisplay, getTableOfContentsEntries, getVisualViewportRect, handleTableAction, handleTableOverlayAction, insertTableAtRange, loomaIconMarkup, measureTableOverlayGeometry, normalizeActiveTableColumnWidths, normalizeImageDimension, normalizeImagePlacement, normalizeLoomaChipColor, normalizeMentionResultLimit, normalizeTableOfContentsConfig, referenceDisplay, resolveTableCellAt, revealLoomaExpandAt, setActiveTableCellAlignment, setActiveTableCellBackground, setReferenceDisplay, shouldShowTextFormattingToolbar, siteRelativeHref };
|
|
16848
|
+
export { DEFAULT_MENTION_RESULT_LIMIT, LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS, LOOMA_ACTIVE_BLOCK_CLASS, LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS, LOOMA_CALLOUT_TONES, LOOMA_CHIP_COLORS, LOOMA_FOOTNOTE_LABEL, LOOMA_ICONS, LoomaActiveBlock, LoomaActiveBlockPluginKey, LoomaCallout, LoomaChip, LoomaExpand, LoomaFigcaption, LoomaFigure, LoomaFootnote, LoomaFootnoteReference, LoomaImage, LoomaInlineImage, LoomaLineBlock, LoomaLinkDefinition, LoomaMentionSuggestionPluginKey, LoomaReference, LoomaReferencePresentation, LoomaSlashCommand, LoomaSmartPaste, LoomaTab, LoomaTable, LoomaTableCell, LoomaTableHeader, LoomaTableKit, LoomaTableOfContents, LoomaTabs, MAX_MENTION_RESULT_LIMIT, TABLE_CELL_BACKGROUND_OPTIONS, TABLE_CELL_BACKGROUND_PRESETS, createDocumentEditorSession, createLoomaMentionExtension, createLoomaSlashCommandExtension, createSiteRelativeLinks, createToolbarTooltip, filterLoomaMentionItems, filterLoomaSlashCommands, findLoomaFootnote, getActiveTableCellAlignment, getActiveTableCellBackground, getActiveTableUiState, getDefaultEditorExtensions, getDefaultSlashCommands, getLoomaTableExtensions, getReferenceDisplay, getTableOfContentsEntries, getVisualViewportRect, handleTableAction, handleTableOverlayAction, imageSourceUrls, insertTableAtRange, loomaIconMarkup, measureTableOverlayGeometry, normalizeActiveTableColumnWidths, normalizeImageDimension, normalizeImagePlacement, normalizeImageSources, normalizeLoomaChipColor, normalizeMentionResultLimit, normalizeTableOfContentsConfig, referenceDisplay, resolveTableCellAt, revealLoomaExpandAt, setActiveTableCellAlignment, setActiveTableCellBackground, setReferenceDisplay, shouldShowTextFormattingToolbar, siteRelativeHref };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@threadlabs/looma",
|
|
3
|
-
"version": "0.53.
|
|
3
|
+
"version": "0.53.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "HTML Next UI components, native DOM support and design tokens.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -99,10 +99,12 @@
|
|
|
99
99
|
"@nextwebwg/html-next": ">=1.0.0-alpha.92",
|
|
100
100
|
"@js-temporal/polyfill": "^0.5.1",
|
|
101
101
|
"dompurify": "3.4.15",
|
|
102
|
-
"expressmark": ">=0.
|
|
102
|
+
"expressmark": ">=0.6.1",
|
|
103
103
|
"highlight.js": "11.11.2",
|
|
104
104
|
"lowlight": "^3.3.0",
|
|
105
|
-
"lucide": "~0.554.0"
|
|
105
|
+
"lucide": "~0.554.0",
|
|
106
|
+
"htmlparser2": "12.0.0",
|
|
107
|
+
"parse-srcset": "1.0.2"
|
|
106
108
|
},
|
|
107
109
|
"peerDependencies": {
|
|
108
110
|
"@tiptap/core": ">=2 <3",
|
package/vanilla/UiEditor.js
CHANGED
|
@@ -307,7 +307,7 @@ export function createUiEditor(options = {}, html) {
|
|
|
307
307
|
const n = (P10 ??= buildTemplate(T10)).cloneNode(true);
|
|
308
308
|
const t0 = n.firstChild.nextSibling;
|
|
309
309
|
const t1 = t0.firstChild.nextSibling;
|
|
310
|
-
const r = { n, a1: t1, v0: null, v1: null, v2: null };
|
|
310
|
+
const r = { n, a1: t1, v0: null, v1: null, v2: null, v3: null };
|
|
311
311
|
I.r["imageShell"] = t0;
|
|
312
312
|
I.r["imageTools"] = t1;
|
|
313
313
|
p10(r, -1, d);
|
|
@@ -315,15 +315,18 @@ export function createUiEditor(options = {}, html) {
|
|
|
315
315
|
};
|
|
316
316
|
const p10 = (r, c, d) => {
|
|
317
317
|
if (c & 1073741825) {
|
|
318
|
-
const x0 = readMember(readMember(v[0], "image"), "
|
|
319
|
-
const s0 = toAttribute(x0, "
|
|
320
|
-
if (s0 !== r.v0) writeAttribute(r.a1, "
|
|
321
|
-
const x1 = readMember(readMember(v[0], "image"), "
|
|
322
|
-
const s1 = toAttribute(x1, "
|
|
323
|
-
if (s1 !== r.v1) writeAttribute(r.a1, "
|
|
324
|
-
const x2 = readMember(readMember(v[0], "image"), "
|
|
325
|
-
const s2 = toAttribute(x2, "
|
|
326
|
-
if (s2 !== r.v2) writeAttribute(r.a1, "
|
|
318
|
+
const x0 = readMember(readMember(v[0], "image"), "inline");
|
|
319
|
+
const s0 = toAttribute(x0, "inline");
|
|
320
|
+
if (s0 !== r.v0) writeAttribute(r.a1, "inline", r.v0 = s0);
|
|
321
|
+
const x1 = readMember(readMember(v[0], "image"), "placement");
|
|
322
|
+
const s1 = toAttribute(x1, "placement");
|
|
323
|
+
if (s1 !== r.v1) writeAttribute(r.a1, "placement", r.v1 = s1);
|
|
324
|
+
const x2 = readMember(readMember(v[0], "image"), "alt");
|
|
325
|
+
const s2 = toAttribute(x2, "alt");
|
|
326
|
+
if (s2 !== r.v2) writeAttribute(r.a1, "alt", r.v2 = s2);
|
|
327
|
+
const x3 = readMember(readMember(v[0], "image"), "target");
|
|
328
|
+
const s3 = toAttribute(x3, "target");
|
|
329
|
+
if (s3 !== r.v3) writeAttribute(r.a1, "target", r.v3 = s3);
|
|
327
330
|
}
|
|
328
331
|
};
|
|
329
332
|
const m11 = (d) => {
|
|
@@ -14,6 +14,7 @@ export interface UiEditorImageToolbarElement extends HTMLDivElement {
|
|
|
14
14
|
}
|
|
15
15
|
export interface UiEditorImageToolbarProps {
|
|
16
16
|
alt?: string | null;
|
|
17
|
+
inline?: boolean | null;
|
|
17
18
|
placement?: "block" | "center" | "wrap-left" | "wrap-right" | null;
|
|
18
19
|
target?: string | null;
|
|
19
20
|
attributes?: Readonly<Record<string, string | number | boolean | null | undefined>>;
|