@astl/editor-tiptap 0.3.3 → 0.4.1
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/CHANGELOG.md +26 -0
- package/dist/define.d.ts +14 -1
- package/dist/define.d.ts.map +1 -1
- package/dist/define.js.map +1 -1
- package/dist/element.d.ts +20 -1
- package/dist/element.d.ts.map +1 -1
- package/dist/element.js +91 -25
- package/dist/element.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/nodes.d.ts +15 -4
- package/dist/nodes.d.ts.map +1 -1
- package/dist/nodes.js +52 -6
- package/dist/nodes.js.map +1 -1
- package/dist/page-actions.d.ts +14 -0
- package/dist/page-actions.d.ts.map +1 -0
- package/dist/page-actions.js +14 -0
- package/dist/page-actions.js.map +1 -0
- package/dist/surface.d.ts +5 -1
- package/dist/surface.d.ts.map +1 -1
- package/dist/surface.js +9 -4
- package/dist/surface.js.map +1 -1
- package/dist/tiptap.d.ts +2 -0
- package/dist/tiptap.d.ts.map +1 -1
- package/dist/tiptap.js +1 -0
- package/dist/tiptap.js.map +1 -1
- package/package.json +6 -6
- package/src/define.ts +14 -0
- package/src/element.ts +110 -23
- package/src/index.ts +2 -0
- package/src/nodes.ts +56 -7
- package/src/page-actions.ts +20 -0
- package/src/surface.ts +12 -3
- package/src/tiptap.ts +2 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The buttons of a page's head on the TipTap surface. A module of its own: the element's entry must not import TipTap,
|
|
3
|
+
* and the `/tiptap` entry must not import the element.
|
|
4
|
+
*/
|
|
5
|
+
/** A button of a page's head on the TipTap surface, for `pageActions`. */
|
|
6
|
+
export type PageAction = 'add-title' | 'check' | 'join' | 'delete';
|
|
7
|
+
/**
|
|
8
|
+
* Every button of a page's head, in their default order: "Add title" (with "Remove title" beside a page's title),
|
|
9
|
+
* "Check this page", "Join with page N" and "Delete page".
|
|
10
|
+
*/
|
|
11
|
+
export declare const PAGE_ACTIONS: readonly PageAction[];
|
|
12
|
+
/** A host's list as the heads draw it: known actions, each once, in its order. */
|
|
13
|
+
export declare function pageActionsOf(list: readonly string[]): readonly PageAction[];
|
|
14
|
+
//# sourceMappingURL=page-actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-actions.d.ts","sourceRoot":"","sources":["../src/page-actions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,0EAA0E;AAC1E,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEnE;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,SAAS,UAAU,EAA6C,CAAC;AAE5F,kFAAkF;AAClF,wBAAgB,aAAa,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,UAAU,EAAE,CAI5E"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The buttons of a page's head on the TipTap surface. A module of its own: the element's entry must not import TipTap,
|
|
3
|
+
* and the `/tiptap` entry must not import the element.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Every button of a page's head, in their default order: "Add title" (with "Remove title" beside a page's title),
|
|
7
|
+
* "Check this page", "Join with page N" and "Delete page".
|
|
8
|
+
*/
|
|
9
|
+
export const PAGE_ACTIONS = ['add-title', 'check', 'join', 'delete'];
|
|
10
|
+
/** A host's list as the heads draw it: known actions, each once, in its order. */
|
|
11
|
+
export function pageActionsOf(list) {
|
|
12
|
+
return PAGE_ACTIONS.filter((action) => list.includes(action)).sort((a, b) => list.indexOf(a) - list.indexOf(b));
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=page-actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-actions.js","sourceRoot":"","sources":["../src/page-actions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAA0B,CAAC,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AAE5F,kFAAkF;AAClF,MAAM,UAAU,aAAa,CAAC,IAAuB;IACnD,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAChE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAC5C,CAAC;AACJ,CAAC"}
|
package/dist/surface.d.ts
CHANGED
|
@@ -8,10 +8,13 @@ import { type Authoring } from '@astl/editor';
|
|
|
8
8
|
import type { LitElement } from 'lit';
|
|
9
9
|
import { type SurfaceChange } from './blocks.js';
|
|
10
10
|
import { type PictureHooks } from './nodes.js';
|
|
11
|
+
import type { PageAction } from './page-actions.js';
|
|
11
12
|
export interface Surface {
|
|
12
13
|
readonly adapter: EditorAdapter;
|
|
13
14
|
/** The authoring its labels come from. */
|
|
14
15
|
readonly authoring: Authoring;
|
|
16
|
+
/** Draws these buttons in the page heads from now on (`pageActions`). */
|
|
17
|
+
setPageActions(actions: readonly PageAction[]): void;
|
|
15
18
|
/** Destroys the editor and removes its element. */
|
|
16
19
|
destroy(): void;
|
|
17
20
|
}
|
|
@@ -19,6 +22,7 @@ export interface Surface {
|
|
|
19
22
|
* A TipTap editor on `source`, appended to `host` (the `<astl-editor>`) in the `surface` slot. `manifests` are every
|
|
20
23
|
* registered type: the schema keeps them all, so content of a type the authoring leaves out is never dropped. `changes`
|
|
21
24
|
* hears of each page added or joined and each block moved or deleted, before the change event of its edit.
|
|
25
|
+
* `pageActions` are the buttons of the page heads.
|
|
22
26
|
*/
|
|
23
|
-
export declare function createSurface(host: LitElement, authoring: Authoring, manifests: readonly ComponentManifest[], source: string, pictures?: PictureHooks, changes?: (change: SurfaceChange) => void): Surface;
|
|
27
|
+
export declare function createSurface(host: LitElement, authoring: Authoring, manifests: readonly ComponentManifest[], source: string, pictures?: PictureHooks, changes?: (change: SurfaceChange) => void, pageActions?: readonly PageAction[]): Surface;
|
|
24
28
|
//# sourceMappingURL=surface.d.ts.map
|
package/dist/surface.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surface.d.ts","sourceRoot":"","sources":["../src/surface.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,KAAK,SAAS,EAAoB,MAAM,cAAc,CAAC;AAGhE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEtC,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAoC,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"surface.d.ts","sourceRoot":"","sources":["../src/surface.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,KAAK,SAAS,EAAoB,MAAM,cAAc,CAAC;AAGhE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEtC,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAoC,KAAK,YAAY,EAAkB,MAAM,YAAY,CAAC;AACjG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,0CAA0C;IAC1C,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,yEAAyE;IACzE,cAAc,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,GAAG,IAAI,CAAC;IACrD,mDAAmD;IACnD,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,iBAAiB,EAAE,EACvC,MAAM,EAAE,MAAM,EACd,QAAQ,CAAC,EAAE,YAAY,EACvB,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,EACzC,WAAW,CAAC,EAAE,SAAS,UAAU,EAAE,GAClC,OAAO,CA8ET"}
|
package/dist/surface.js
CHANGED
|
@@ -3,14 +3,15 @@ import { Editor } from '@tiptap/core';
|
|
|
3
3
|
import { EditorState } from '@tiptap/pm/state';
|
|
4
4
|
import { createTiptapAdapter } from './adapter.js';
|
|
5
5
|
import { BLOCK_CHANGE } from './blocks.js';
|
|
6
|
-
import { astrolabeExtensions, PAGE_CHANGE } from './nodes.js';
|
|
6
|
+
import { astrolabeExtensions, PAGE_CHANGE, setPageActions } from './nodes.js';
|
|
7
7
|
import { adoptSurfaceStyles, SURFACE_CLASS } from './styles.js';
|
|
8
8
|
/**
|
|
9
9
|
* A TipTap editor on `source`, appended to `host` (the `<astl-editor>`) in the `surface` slot. `manifests` are every
|
|
10
10
|
* registered type: the schema keeps them all, so content of a type the authoring leaves out is never dropped. `changes`
|
|
11
11
|
* hears of each page added or joined and each block moved or deleted, before the change event of its edit.
|
|
12
|
+
* `pageActions` are the buttons of the page heads.
|
|
12
13
|
*/
|
|
13
|
-
export function createSurface(host, authoring, manifests, source, pictures, changes) {
|
|
14
|
+
export function createSurface(host, authoring, manifests, source, pictures, changes, pageActions) {
|
|
14
15
|
adoptSurfaceStyles(host);
|
|
15
16
|
const mount = document.createElement('div');
|
|
16
17
|
mount.slot = 'surface';
|
|
@@ -42,7 +43,10 @@ export function createSurface(host, authoring, manifests, source, pictures, chan
|
|
|
42
43
|
element: mount,
|
|
43
44
|
// No <style> element: the surface stylesheet is adopted (strict CSP allows it).
|
|
44
45
|
injectCSS: false,
|
|
45
|
-
extensions: astrolabeExtensions(authoring, manifests,
|
|
46
|
+
extensions: astrolabeExtensions(authoring, manifests, {
|
|
47
|
+
...(pictures === undefined ? {} : { pictures }),
|
|
48
|
+
...(pageActions === undefined ? {} : { pageActions }),
|
|
49
|
+
}),
|
|
46
50
|
editorProps: {
|
|
47
51
|
attributes: (state) => ({
|
|
48
52
|
'aria-label': authoring.t(EDITOR_NAMESPACE, 'surface.label'),
|
|
@@ -80,7 +84,8 @@ export function createSurface(host, authoring, manifests, source, pictures, chan
|
|
|
80
84
|
if (toolbar !== null && editor?.isDestroyed === false)
|
|
81
85
|
covered.observe(toolbar);
|
|
82
86
|
});
|
|
83
|
-
|
|
87
|
+
const made = editor;
|
|
88
|
+
return { adapter, authoring, destroy, setPageActions: (actions) => setPageActions(made, actions) };
|
|
84
89
|
}
|
|
85
90
|
catch (error) {
|
|
86
91
|
destroy();
|
package/dist/surface.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surface.js","sourceRoot":"","sources":["../src/surface.ts"],"names":[],"mappings":"AAMA,OAAO,EAAkB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,YAAY,EAAsB,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAqB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"surface.js","sourceRoot":"","sources":["../src/surface.ts"],"names":[],"mappings":"AAMA,OAAO,EAAkB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,cA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,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAC;YACnE,IAAI,OAAO,KAAK,IAAI,IAAI,MAAM,EAAE,WAAW,KAAK,KAAK;gBAAE,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAClF,CAAC,CAAC,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,CAAC;QACpB,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC;IACrG,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,EAAE,CAAC;QACV,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/dist/tiptap.d.ts
CHANGED
|
@@ -7,4 +7,6 @@
|
|
|
7
7
|
export { createTiptapAdapter } from './adapter.js';
|
|
8
8
|
export type { PictureHooks } from './nodes.js';
|
|
9
9
|
export { astrolabeExtensions } from './nodes.js';
|
|
10
|
+
export type { PageAction } from './page-actions.js';
|
|
11
|
+
export { PAGE_ACTIONS } from './page-actions.js';
|
|
10
12
|
//# sourceMappingURL=tiptap.d.ts.map
|
package/dist/tiptap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tiptap.d.ts","sourceRoot":"","sources":["../src/tiptap.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"tiptap.d.ts","sourceRoot":"","sources":["../src/tiptap.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/tiptap.js
CHANGED
package/dist/tiptap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tiptap.js","sourceRoot":"","sources":["../src/tiptap.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"tiptap.js","sourceRoot":"","sources":["../src/tiptap.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astl/editor-tiptap",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "<astl-editor>: the authoring kit around a TipTap surface, loaded only when no other editor is plugged in through an adapter.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astrolabe",
|
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
"access": "public"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@astl/core": "0.
|
|
57
|
-
"@astl/editor": "0.
|
|
58
|
-
"@astl/engine": "0.
|
|
59
|
-
"@astl/player": "0.
|
|
60
|
-
"@astl/tokens": "0.
|
|
56
|
+
"@astl/core": "0.4.1",
|
|
57
|
+
"@astl/editor": "0.4.1",
|
|
58
|
+
"@astl/engine": "0.4.1",
|
|
59
|
+
"@astl/player": "0.4.1",
|
|
60
|
+
"@astl/tokens": "0.4.1",
|
|
61
61
|
"@tiptap/core": "3.32.0",
|
|
62
62
|
"@tiptap/pm": "3.32.0",
|
|
63
63
|
"@tiptap/starter-kit": "3.32.0",
|
package/src/define.ts
CHANGED
|
@@ -4,10 +4,12 @@ import {
|
|
|
4
4
|
type EditorFont,
|
|
5
5
|
type EditorStylePreset,
|
|
6
6
|
type PickPicture,
|
|
7
|
+
type ToolbarLayout,
|
|
7
8
|
type UploadAsset,
|
|
8
9
|
} from '@astl/editor';
|
|
9
10
|
import type { ElementEntry } from '@astl/player';
|
|
10
11
|
import { AstlEditor, register } from './element.js';
|
|
12
|
+
import type { PageAction } from './page-actions.js';
|
|
11
13
|
|
|
12
14
|
/** The same option names, types and meanings as `createEngine` and `definePlayer`; the editor makes its own secret. */
|
|
13
15
|
export interface DefineEditorOptions extends Omit<EngineOptions, 'secret'> {
|
|
@@ -57,6 +59,18 @@ export interface DefineEditorOptions extends Omit<EngineOptions, 'secret'> {
|
|
|
57
59
|
* Default: none.
|
|
58
60
|
*/
|
|
59
61
|
readonly views?: readonly EditorHostView[];
|
|
62
|
+
/**
|
|
63
|
+
* The toolbar's items and their order: groups of item names (`TOOLBAR_ITEMS`), a rule between groups; an item not
|
|
64
|
+
* named is not drawn. A later call's layout replaces it; an element's `toolbarLayout` overrides it. Default:
|
|
65
|
+
* `DEFAULT_TOOLBAR_LAYOUT`.
|
|
66
|
+
*/
|
|
67
|
+
readonly toolbarLayout?: ToolbarLayout;
|
|
68
|
+
/**
|
|
69
|
+
* The buttons of each page's head on the TipTap surface, in order: `add-title`, `check`, `join`, `delete`; one not
|
|
70
|
+
* listed is not drawn. A later call's list replaces it; an element's `pageActions` overrides it. Default:
|
|
71
|
+
* `PAGE_ACTIONS`, all four.
|
|
72
|
+
*/
|
|
73
|
+
readonly pageActions?: readonly PageAction[];
|
|
60
74
|
}
|
|
61
75
|
|
|
62
76
|
/** A host view of `<astl-editor>`: its name (lower-case letters, digits and dashes) and its label in the switch. */
|
package/src/element.ts
CHANGED
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
createAuthoring,
|
|
32
32
|
DEFAULT_FONTS,
|
|
33
33
|
DEFAULT_STYLES,
|
|
34
|
+
DEFAULT_TOOLBAR_LAYOUT,
|
|
34
35
|
EDITOR_NAMESPACE,
|
|
35
36
|
type EditorFont,
|
|
36
37
|
type EditorStylePreset,
|
|
@@ -40,7 +41,9 @@ import {
|
|
|
40
41
|
type HelpPart,
|
|
41
42
|
type Outline,
|
|
42
43
|
type PickPicture,
|
|
44
|
+
type ToolbarLayout,
|
|
43
45
|
type ToolbarView,
|
|
46
|
+
toolbarButtonParts,
|
|
44
47
|
type UploadAsset,
|
|
45
48
|
} from '@astl/editor';
|
|
46
49
|
import { createEngine } from '@astl/engine';
|
|
@@ -61,6 +64,7 @@ import {
|
|
|
61
64
|
import { keyed } from 'lit/directives/keyed.js';
|
|
62
65
|
import type { SurfaceChange } from './blocks.js';
|
|
63
66
|
import type { DefineEditorOptions, EditorHostView } from './define.js';
|
|
67
|
+
import { PAGE_ACTIONS, type PageAction, pageActionsOf } from './page-actions.js';
|
|
64
68
|
import type { Surface } from './surface.js';
|
|
65
69
|
|
|
66
70
|
/**
|
|
@@ -121,11 +125,6 @@ const editorStyles: CSSResultGroup = [
|
|
|
121
125
|
.surface {
|
|
122
126
|
position: relative;
|
|
123
127
|
}
|
|
124
|
-
::slotted(*) {
|
|
125
|
-
box-sizing: border-box;
|
|
126
|
-
inline-size: 100%;
|
|
127
|
-
max-inline-size: 100%;
|
|
128
|
-
}
|
|
129
128
|
.status {
|
|
130
129
|
margin: 0;
|
|
131
130
|
padding: var(--astl-space-4);
|
|
@@ -135,6 +134,14 @@ const editorStyles: CSSResultGroup = [
|
|
|
135
134
|
color: var(--astl-ink-muted);
|
|
136
135
|
}
|
|
137
136
|
`,
|
|
137
|
+
// The host's elements take their column's width; those in the toolbar's ends keep their own, as items of its bar.
|
|
138
|
+
css`
|
|
139
|
+
::slotted(:not([slot='toolbar-start'], [slot='toolbar-end'])) {
|
|
140
|
+
box-sizing: border-box;
|
|
141
|
+
inline-size: 100%;
|
|
142
|
+
max-inline-size: 100%;
|
|
143
|
+
}
|
|
144
|
+
`,
|
|
138
145
|
// The side column and the host's columns in another view, and a host column with nothing slotted: out of the way (the
|
|
139
146
|
// grid keeps no track and no gap for them). The notice line with nothing to say: out of sight, but still in the
|
|
140
147
|
// accessibility tree, so its next message is announced.
|
|
@@ -237,6 +244,10 @@ interface Registered {
|
|
|
237
244
|
readonly featured: readonly string[];
|
|
238
245
|
/** The host's views (`DefineEditorOptions.views`). */
|
|
239
246
|
readonly views: readonly EditorHostView[];
|
|
247
|
+
/** The toolbar's items and their order (`DefineEditorOptions.toolbarLayout`). */
|
|
248
|
+
readonly toolbarLayout: ToolbarLayout;
|
|
249
|
+
/** The buttons of the page heads (`DefineEditorOptions.pageActions`). */
|
|
250
|
+
readonly pageActions: readonly PageAction[];
|
|
240
251
|
/** The insert menus' catalogs (`DefineEditorOptions.menuMessages`). */
|
|
241
252
|
readonly menuMessages: (() => Promise<readonly MessageCatalog[]>) | null;
|
|
242
253
|
/** The engine of every registered component, for editors without a `components` list. */
|
|
@@ -293,6 +304,8 @@ const EMPTY: Lists = {
|
|
|
293
304
|
styles: DEFAULT_STYLES,
|
|
294
305
|
featured: [],
|
|
295
306
|
views: [],
|
|
307
|
+
toolbarLayout: DEFAULT_TOOLBAR_LAYOUT,
|
|
308
|
+
pageActions: PAGE_ACTIONS,
|
|
296
309
|
menuMessages: null,
|
|
297
310
|
};
|
|
298
311
|
|
|
@@ -344,12 +357,14 @@ export function register(options: DefineEditorOptions): void {
|
|
|
344
357
|
styles: options.styles ?? before.styles,
|
|
345
358
|
featured: options.featured ?? before.featured,
|
|
346
359
|
views: options.views ?? before.views,
|
|
360
|
+
toolbarLayout: options.toolbarLayout ?? before.toolbarLayout,
|
|
361
|
+
pageActions: options.pageActions ?? before.pageActions,
|
|
347
362
|
menuMessages: options.menuMessages ?? before.menuMessages,
|
|
348
363
|
};
|
|
349
364
|
// Nothing new (the same objects again): connected editors keep their surface, cursor and undo history.
|
|
350
365
|
const maps = ['components', 'editors', 'elements', 'styleTemplates', 'slotKinds'] as const;
|
|
351
366
|
const profile = (p: Lists['profile']) => JSON.stringify(Object.entries(p).sort());
|
|
352
|
-
|
|
367
|
+
const sameKit =
|
|
353
368
|
registered !== null &&
|
|
354
369
|
maps.every((list) => lists[list].size === before[list].size) &&
|
|
355
370
|
lists.catalogs.length === before.catalogs.length &&
|
|
@@ -360,10 +375,13 @@ export function register(options: DefineEditorOptions): void {
|
|
|
360
375
|
lists.menuMessages === before.menuMessages &&
|
|
361
376
|
JSON.stringify(lists.fonts) === JSON.stringify(before.fonts) &&
|
|
362
377
|
JSON.stringify(lists.styles) === JSON.stringify(before.styles) &&
|
|
363
|
-
lists.
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
378
|
+
profile(lists.profile) === profile(before.profile);
|
|
379
|
+
// Only the toolbar's and the page heads' layout changed: the same authoring, so the editors keep their surfaces.
|
|
380
|
+
if (registered !== null && sameKit) {
|
|
381
|
+
const layout = (r: Lists) => JSON.stringify([r.featured, r.views, r.toolbarLayout, r.pageActions]);
|
|
382
|
+
if (layout(lists) === layout(before)) return;
|
|
383
|
+
registered = { ...registered, ...lists };
|
|
384
|
+
for (const editor of connected) editor.requestUpdate();
|
|
367
385
|
return;
|
|
368
386
|
}
|
|
369
387
|
// The engine and the kit check definitions and descriptors now, not when an editor first renders.
|
|
@@ -409,6 +427,8 @@ interface Notice {
|
|
|
409
427
|
const CHANGE = 'astl-editor-change';
|
|
410
428
|
const READY = 'astl-editor-ready';
|
|
411
429
|
const VIEW = 'astl-editor-view';
|
|
430
|
+
/** The toolbar's block size in px, kept on the element for a host's layout (a sticky toolbar, columns under it). */
|
|
431
|
+
const TOOLBAR_SIZE = '--astl-editor-toolbar-block-size';
|
|
412
432
|
|
|
413
433
|
/** The views of every editor: the surface, and the source as HTML (not for a surface that is the source already). */
|
|
414
434
|
const OWN_VIEWS: readonly string[] = ['visual', 'source'];
|
|
@@ -489,6 +509,8 @@ export class AstlEditor extends LitElement {
|
|
|
489
509
|
components: { converter: listAttribute },
|
|
490
510
|
featured: { converter: listAttribute },
|
|
491
511
|
panels: { converter: listAttribute },
|
|
512
|
+
toolbarLayout: { attribute: false },
|
|
513
|
+
pageActions: { attribute: 'page-actions', converter: listAttribute },
|
|
492
514
|
view: {},
|
|
493
515
|
views: { converter: viewsAttribute },
|
|
494
516
|
theme: {},
|
|
@@ -517,6 +539,18 @@ export class AstlEditor extends LitElement {
|
|
|
517
539
|
* or `<astl-issues>`, wired with `authoring` and `adapter` once the editor is ready.
|
|
518
540
|
*/
|
|
519
541
|
declare panels: readonly string[] | null;
|
|
542
|
+
/**
|
|
543
|
+
* The toolbar's items and their order, for this editor, in place of the `toolbarLayout` of `defineEditor`: groups of
|
|
544
|
+
* item names (`TOOLBAR_ITEMS`), a rule between groups; an item not named is not drawn. Null: the registered layout.
|
|
545
|
+
*/
|
|
546
|
+
declare toolbarLayout: ToolbarLayout | null;
|
|
547
|
+
/**
|
|
548
|
+
* The buttons of each page's head on the TipTap surface, in order (space-separated in the attribute): `add-title`,
|
|
549
|
+
* `check`, `join`, `delete`; one not listed is not drawn, and a change redraws the heads at once. Null: the list
|
|
550
|
+
* `defineEditor` got. The adapter's `addPage`, `mergePage`, `removePage` and `setPageCheck` stay for a host's own
|
|
551
|
+
* controls.
|
|
552
|
+
*/
|
|
553
|
+
declare pageActions: readonly PageAction[] | null;
|
|
520
554
|
/**
|
|
521
555
|
* What the editor shows: `visual` (default) the surface; `source` the document's HTML in a text area, which leaving
|
|
522
556
|
* applies (with errors the editor stays there and lists them, so no text is lost); or the `name` of one of `views`.
|
|
@@ -629,6 +663,8 @@ export class AstlEditor extends LitElement {
|
|
|
629
663
|
this.components = null;
|
|
630
664
|
this.featured = null;
|
|
631
665
|
this.panels = null;
|
|
666
|
+
this.toolbarLayout = null;
|
|
667
|
+
this.pageActions = null;
|
|
632
668
|
this.view = 'visual';
|
|
633
669
|
this.views = null;
|
|
634
670
|
this.theme = 'auto';
|
|
@@ -664,6 +700,32 @@ export class AstlEditor extends LitElement {
|
|
|
664
700
|
return this.#ready;
|
|
665
701
|
}
|
|
666
702
|
|
|
703
|
+
/**
|
|
704
|
+
* The toolbar (`<astl-toolbar>`, `part="toolbar"`) once the editor has rendered, else null: for its box, its
|
|
705
|
+
* `popupOpen` and its `openMenu` and `openStyle`.
|
|
706
|
+
*/
|
|
707
|
+
get toolbar(): AstlToolbar | null {
|
|
708
|
+
return this.shadowRoot?.querySelector<AstlToolbar>('astl-toolbar') ?? null;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* Keeps `--astl-editor-toolbar-block-size` on this element: the toolbar's block size, one row or more. Made when the
|
|
713
|
+
* editor first connects: a host may construct the element where there is no browser (a server reads its `authoring`).
|
|
714
|
+
*/
|
|
715
|
+
#toolbarSize: ResizeObserver | null = null;
|
|
716
|
+
|
|
717
|
+
/** Measures the toolbar while connected (the same element across renders). */
|
|
718
|
+
#measureToolbar(): void {
|
|
719
|
+
this.#toolbarSize?.disconnect();
|
|
720
|
+
const toolbar = this.isConnected ? this.toolbar : null;
|
|
721
|
+
if (toolbar === null) return;
|
|
722
|
+
this.#toolbarSize ??= new ResizeObserver(([entry]) => {
|
|
723
|
+
const size = entry?.borderBoxSize[0]?.blockSize;
|
|
724
|
+
if (size !== undefined) this.style.setProperty(TOOLBAR_SIZE, `${size}px`);
|
|
725
|
+
});
|
|
726
|
+
this.#toolbarSize.observe(toolbar);
|
|
727
|
+
}
|
|
728
|
+
|
|
667
729
|
/**
|
|
668
730
|
* Compiles the current value and plays it in the preview, as the preview's own button does. Resolves when it plays,
|
|
669
731
|
* or shows why it cannot.
|
|
@@ -692,12 +754,14 @@ export class AstlEditor extends LitElement {
|
|
|
692
754
|
// applied the properties set before the element was defined (an `adapter`).
|
|
693
755
|
if (this.#builtIn === true) void this.#open();
|
|
694
756
|
this.#subscribe();
|
|
757
|
+
this.#measureToolbar();
|
|
695
758
|
}
|
|
696
759
|
|
|
697
760
|
override disconnectedCallback(): void {
|
|
698
761
|
super.disconnectedCallback();
|
|
699
762
|
connected.delete(this);
|
|
700
763
|
clearTimeout(this.#counting);
|
|
764
|
+
this.#measureToolbar();
|
|
701
765
|
this.#readyFor = null;
|
|
702
766
|
this.#subscribe();
|
|
703
767
|
// ProseMirror listens on the document: a removed editor is destroyed, its source kept for a reconnect.
|
|
@@ -709,6 +773,13 @@ export class AstlEditor extends LitElement {
|
|
|
709
773
|
this.adapter = null;
|
|
710
774
|
}
|
|
711
775
|
|
|
776
|
+
/** The page heads' buttons: the element's (also in the attribute's form, a string), else the registered ones. */
|
|
777
|
+
#pageActions(): readonly PageAction[] {
|
|
778
|
+
const given = this.pageActions as readonly string[] | string | null;
|
|
779
|
+
const list = typeof given === 'string' ? given.split(/\s+/) : given;
|
|
780
|
+
return pageActionsOf(Array.isArray(list) ? list : current().pageActions);
|
|
781
|
+
}
|
|
782
|
+
|
|
712
783
|
/** The host's views: the element's, else the registered ones. */
|
|
713
784
|
#hostViews(): readonly EditorHostView[] {
|
|
714
785
|
const views = this.views ?? current().views;
|
|
@@ -801,15 +872,22 @@ export class AstlEditor extends LitElement {
|
|
|
801
872
|
source,
|
|
802
873
|
this.#pictures,
|
|
803
874
|
this.#pages,
|
|
875
|
+
this.#pageActions(),
|
|
804
876
|
);
|
|
805
877
|
this.adapter = this.#surface.adapter;
|
|
806
878
|
}
|
|
807
879
|
this.#subscribe();
|
|
808
880
|
}
|
|
809
881
|
|
|
882
|
+
protected override firstUpdated(): void {
|
|
883
|
+
this.#measureToolbar();
|
|
884
|
+
}
|
|
885
|
+
|
|
810
886
|
protected override updated(changed: PropertyValues<this>): void {
|
|
811
887
|
// The preview reads its theme when it renders.
|
|
812
888
|
if (changed.has('theme')) this.renderRoot.querySelector<LitElement>('astl-preview')?.requestUpdate();
|
|
889
|
+
// The element's list, or a registration's: the heads draw again only when it says something new.
|
|
890
|
+
this.#surface?.setPageActions(this.#pageActions());
|
|
813
891
|
const adapter = this.adapter;
|
|
814
892
|
if (adapter !== null && adapter !== this.#readyFor && this.isConnected) {
|
|
815
893
|
this.#readyFor = adapter;
|
|
@@ -849,6 +927,7 @@ export class AstlEditor extends LitElement {
|
|
|
849
927
|
this.value,
|
|
850
928
|
this.#pictures,
|
|
851
929
|
this.#pages,
|
|
930
|
+
this.#pageActions(),
|
|
852
931
|
);
|
|
853
932
|
this.#pending = null;
|
|
854
933
|
this.adapter = this.#surface.adapter;
|
|
@@ -916,10 +995,28 @@ export class AstlEditor extends LitElement {
|
|
|
916
995
|
typeof value === 'string' ? value.split(/\s+/).filter((name) => name !== '') : value;
|
|
917
996
|
const featured = list(this.featured) ?? current().featured;
|
|
918
997
|
const panels = (list(this.panels) ?? PANELS).filter((name) => PANELS.includes(name));
|
|
998
|
+
const toolbarLayout = Array.isArray(this.toolbarLayout) ? this.toolbarLayout : current().toolbarLayout;
|
|
999
|
+
const t = (key: string, params?: MessageParams) => authoring.t(EDITOR_NAMESPACE, key, params);
|
|
1000
|
+
const view = this.#view();
|
|
1001
|
+
// A surface that edits the source as text is the HTML already: its one view takes the HTML view's name and
|
|
1002
|
+
// description, as it makes that view needless.
|
|
1003
|
+
const views: ToolbarView[] = [
|
|
1004
|
+
...this.#ownViews().map((name) => {
|
|
1005
|
+
const shown = adapter?.editsSource === true ? 'source' : name;
|
|
1006
|
+
return { name, label: t(`view.${shown}`), description: t(`view.${shown}Hint`) };
|
|
1007
|
+
}),
|
|
1008
|
+
...this.#hostViews(),
|
|
1009
|
+
];
|
|
919
1010
|
const icons = new Set([
|
|
920
1011
|
...KIT_ICONS,
|
|
921
1012
|
...authoring.descriptors.flatMap((d) => [d.icon, ...(d.templates ?? []).map((t) => t.icon ?? d.icon)]),
|
|
922
1013
|
]);
|
|
1014
|
+
// Every button by its name too, so a host restyles one (`::part(toolbar-button-bold)`).
|
|
1015
|
+
const buttons = toolbarButtonParts({
|
|
1016
|
+
featured,
|
|
1017
|
+
wraps: authoring.descriptors.filter((d) => d.wrap !== undefined).map((d) => d.manifest.tag),
|
|
1018
|
+
views: views.map((one) => one.name),
|
|
1019
|
+
});
|
|
923
1020
|
const exported = [
|
|
924
1021
|
'toolbar: toolbar-bar',
|
|
925
1022
|
'button: toolbar-button',
|
|
@@ -935,31 +1032,21 @@ export class AstlEditor extends LitElement {
|
|
|
935
1032
|
'style-panel',
|
|
936
1033
|
]
|
|
937
1034
|
.concat([...icons].map((name) => `icon-${name}`))
|
|
1035
|
+
.concat(buttons.map((name) => `${name}: toolbar-${name}`))
|
|
938
1036
|
.join(', ');
|
|
939
1037
|
const panel = (name: string) =>
|
|
940
1038
|
name === 'issues'
|
|
941
1039
|
? html`<astl-issues part="issues" data-theme=${theme} .authoring=${authoring} .adapter=${adapter}></astl-issues>`
|
|
942
1040
|
: html`<astl-inspector part="inspector" exportparts=${INSPECTOR_PARTS} data-theme=${theme} .authoring=${authoring} .adapter=${adapter}></astl-inspector>`;
|
|
943
|
-
const t = (key: string, params?: MessageParams) => authoring.t(EDITOR_NAMESPACE, key, params);
|
|
944
|
-
const view = this.#view();
|
|
945
|
-
// A surface that edits the source as text is the HTML already: its one view takes the HTML view's name and
|
|
946
|
-
// description, as it makes that view needless.
|
|
947
|
-
const views: ToolbarView[] = [
|
|
948
|
-
...this.#ownViews().map((name) => {
|
|
949
|
-
const shown = adapter?.editsSource === true ? 'source' : name;
|
|
950
|
-
return { name, label: t(`view.${shown}`), description: t(`view.${shown}Hint`) };
|
|
951
|
-
}),
|
|
952
|
-
...this.#hostViews(),
|
|
953
|
-
];
|
|
954
1041
|
// The toolbar spans the editor, as a word processor's: above the text and the side column.
|
|
955
1042
|
// Another view takes the surface's place, without the side column; the notice line stays, the one live region.
|
|
956
1043
|
const away = view !== 'visual';
|
|
957
1044
|
return html`<div class=${panels.length === 0 || away ? 'layout solo' : 'layout'}>
|
|
958
1045
|
<astl-toolbar part="toolbar" exportparts=${exported} data-theme=${theme} .authoring=${authoring}
|
|
959
|
-
.adapter=${adapter} .featured=${featured} .views=${views} .view=${view}
|
|
1046
|
+
.adapter=${adapter} .featured=${featured} .views=${views} .view=${view} .layout=${toolbarLayout}
|
|
960
1047
|
@astl-toolbar-view=${(event: CustomEvent<{ view: string }>) => {
|
|
961
1048
|
this.view = event.detail.view;
|
|
962
|
-
}}></astl-toolbar>
|
|
1049
|
+
}}><slot name="toolbar-start" slot="start"></slot><slot name="toolbar-end" slot="end"></slot></astl-toolbar>
|
|
963
1050
|
${this.#statusLine()}
|
|
964
1051
|
<div class="work" part="work">
|
|
965
1052
|
<div class="start" part="start" ?hidden=${away || !this.#slotted.start}>
|
package/src/index.ts
CHANGED
|
@@ -8,3 +8,5 @@
|
|
|
8
8
|
export type { DefineEditorOptions, EditorHostView } from './define.js';
|
|
9
9
|
export { defineEditor } from './define.js';
|
|
10
10
|
export { AstlEditor } from './element.js';
|
|
11
|
+
export type { PageAction } from './page-actions.js';
|
|
12
|
+
export { PAGE_ACTIONS } from './page-actions.js';
|