@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
package/EXPRESSIVE-MARKDOWN.md
CHANGED
|
@@ -12,8 +12,10 @@ const written = editorDocumentToMarkdown(editedEditorJson, { original: markdown
|
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
Pass the Markdown a document was read from as `original` when writing it back.
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
Unchanged supported blocks retain their authored spelling, front matter and
|
|
16
|
+
spacing. Safe HTML filtering and normalization apply when writing HTML; native
|
|
17
|
+
picture headings serialize their current heading and image structure. An edit
|
|
18
|
+
leaves the source of every other supported block alone. An edited
|
|
17
19
|
block keeps the spellings it still reads as, such as `_` emphasis or a setext
|
|
18
20
|
heading. Without `original`, the writer uses Expressmark's preferred forms.
|
|
19
21
|
|
|
@@ -40,6 +42,29 @@ See the [proposal and syntax](https://nextwebwg.org/expressive-markdown/) and
|
|
|
40
42
|
|
|
41
43
|
## Conversion behavior
|
|
42
44
|
|
|
45
|
+
Images inside text and headings load as `loomaInlineImage`; standalone images
|
|
46
|
+
retain the `image` block and its insertion command. Native pictures preserve
|
|
47
|
+
their fallback image, alt text, dimensions and ordered `sources` array. Each
|
|
48
|
+
source stores `srcset` and optional `media`, `type`, `width` and `height`.
|
|
49
|
+
These are authored choices, separate from a host's transient delivery renditions.
|
|
50
|
+
`imageSourceUrls` from the editor extensions lists every alternative URL for
|
|
51
|
+
host authorization and asset rewriting; validate the fallback `src` as well.
|
|
52
|
+
The shared safe URL profile applies to every srcset candidate. Inline image
|
|
53
|
+
actions edit the description or delete the image while keeping its text position.
|
|
54
|
+
|
|
55
|
+
Leading-pipe line blocks load as `loomaLineBlock` text blocks. Their explicit
|
|
56
|
+
line breaks, inline formatting and line-block identity survive editing, HTML
|
|
57
|
+
and Markdown export. Repeated identical emphasis becomes one editor mark.
|
|
58
|
+
List items that begin with a quote or another block receive the empty leading
|
|
59
|
+
paragraph required by editor list commands, retaining their authored blocks.
|
|
60
|
+
|
|
61
|
+
HTML disclosures whose opening, Markdown body and closing tags are separate
|
|
62
|
+
CommonMark blocks load as one editable section. Nested sections retain their
|
|
63
|
+
boundaries. An unchanged section keeps its original HTML source when writing
|
|
64
|
+
with `original`; editing its body writes the current section while preserving
|
|
65
|
+
adjacent authored blocks. An unclosed section contains the rest of its enclosing
|
|
66
|
+
content, following HTML, and an empty section receives an editable paragraph.
|
|
67
|
+
|
|
43
68
|
Ordinary punctuation stays readable: ranges such as `[-1, 1]`, `array[index]`,
|
|
44
69
|
`user_id` and `a@word` do not need backslashes. The shared writer escapes text
|
|
45
70
|
only when its context would interpret it as syntax. Mentions start at the
|
|
@@ -183,6 +183,7 @@
|
|
|
183
183
|
<div $ref="imageShell" class="looma-editor__floating-shell looma-editor__image-shell" hidden>
|
|
184
184
|
<ui-editor-image-toolbar
|
|
185
185
|
$ref="imageTools"
|
|
186
|
+
from:inline="$view.image.inline"
|
|
186
187
|
from:placement="$view.image.placement"
|
|
187
188
|
from:alt="$view.image.alt"
|
|
188
189
|
from:target="$view.image.target"
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
<defs>
|
|
14
14
|
<prop name="placement" type="keyword" values="block, center, wrap-left, wrap-right" default="block"
|
|
15
15
|
>How the selected image sits in the text; its command shows as pressed.</prop>
|
|
16
|
+
<prop name="inline" type="boolean" default="false">The selected image sits within text. Its actions are description and delete.</prop>
|
|
16
17
|
<prop name="alt" type="string" default="">The selected image's description, which the description form starts from.</prop>
|
|
17
18
|
<prop name="target" type="string" default=""
|
|
18
19
|
>Identifies the image the toolbar acts on. When it changes, an open description draft is cancelled rather than applied to another image.</prop>
|
|
@@ -33,6 +34,7 @@
|
|
|
33
34
|
<ui-text as="div" font="sans">
|
|
34
35
|
<ui-editor-toolbar floating aria-label="Image actions">
|
|
35
36
|
<ui-icon-button
|
|
37
|
+
$if="not $inline"
|
|
36
38
|
from:id="concat($base, '-block')"
|
|
37
39
|
label="Image in line"
|
|
38
40
|
size="sm"
|
|
@@ -41,6 +43,7 @@
|
|
|
41
43
|
from:aria-pressed="concat($placement = 'block')"
|
|
42
44
|
><ui-icon name="panel-top"></ui-icon></ui-icon-button>
|
|
43
45
|
<ui-icon-button
|
|
46
|
+
$if="not $inline"
|
|
44
47
|
from:id="concat($base, '-center')"
|
|
45
48
|
label="Center image"
|
|
46
49
|
size="sm"
|
|
@@ -49,6 +52,7 @@
|
|
|
49
52
|
from:aria-pressed="concat($placement = 'center')"
|
|
50
53
|
><ui-icon name="align-center"></ui-icon></ui-icon-button>
|
|
51
54
|
<ui-icon-button
|
|
55
|
+
$if="not $inline"
|
|
52
56
|
from:id="concat($base, '-wrap-left')"
|
|
53
57
|
label="Wrap text to the right"
|
|
54
58
|
size="sm"
|
|
@@ -57,6 +61,7 @@
|
|
|
57
61
|
from:aria-pressed="concat($placement = 'wrap-left')"
|
|
58
62
|
><ui-icon name="panel-left"></ui-icon></ui-icon-button>
|
|
59
63
|
<ui-icon-button
|
|
64
|
+
$if="not $inline"
|
|
60
65
|
from:id="concat($base, '-wrap-right')"
|
|
61
66
|
label="Wrap text to the left"
|
|
62
67
|
size="sm"
|