@sciflow/editor-start 0.0.1-beta2 → 0.0.3
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/README.md +49 -2
- package/THIRD_PARTY_LICENSES +9 -0
- package/bin/extract-translations.mjs +54 -0
- package/dist/bundle/sciflow-editor.css +1 -1
- package/dist/bundle/sciflow-editor.js +9821 -16643
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/lib/citation-source-adapter.d.ts +1 -1
- package/dist/lib/citation-source-adapter.d.ts.map +1 -1
- package/dist/lib/citation-source-adapter.js +1 -1
- package/dist/lib/drag-preview.d.ts.map +1 -1
- package/dist/lib/drag-preview.js +9 -2
- package/dist/lib/editor-element.d.ts +14 -3
- package/dist/lib/editor-element.d.ts.map +1 -1
- package/dist/lib/editor-element.js +25 -1
- package/dist/lib/format-bar.d.ts +19 -2
- package/dist/lib/format-bar.d.ts.map +1 -1
- package/dist/lib/format-bar.js +303 -59
- package/dist/lib/ghost-cursor.d.ts +10 -0
- package/dist/lib/ghost-cursor.d.ts.map +1 -0
- package/dist/lib/ghost-cursor.js +59 -0
- package/dist/lib/icons-generated.d.ts +14 -0
- package/dist/lib/icons-generated.d.ts.map +1 -0
- package/dist/lib/icons-generated.js +60 -0
- package/dist/lib/outline.d.ts +8 -5
- package/dist/lib/outline.d.ts.map +1 -1
- package/dist/lib/outline.js +80 -35
- package/dist/lib/reference-list.d.ts +10 -2
- package/dist/lib/reference-list.d.ts.map +1 -1
- package/dist/lib/reference-list.js +45 -9
- package/dist/lib/selection-editor.d.ts +16 -0
- package/dist/lib/selection-editor.d.ts.map +1 -1
- package/dist/lib/selection-editor.js +291 -148
- package/dist/lib/selection-ui-renderer.d.ts +1 -0
- package/dist/lib/selection-ui-renderer.d.ts.map +1 -1
- package/dist/lib/selection-ui-renderer.js +3 -3
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +24 -17
- package/dist/demo/demo.js +0 -56
- package/dist/demo/index.html +0 -169
- package/dist/lib/citation-drop.d.ts +0 -25
- package/dist/lib/citation-drop.d.ts.map +0 -1
- package/dist/lib/citation-drop.js +0 -53
package/dist/index.d.ts
CHANGED
|
@@ -6,12 +6,17 @@
|
|
|
6
6
|
* bundling strategy used for the demo so integrators have a single import path.
|
|
7
7
|
*/
|
|
8
8
|
export * from './lib/editor-element.js';
|
|
9
|
+
export { ghostCursorFeature } from './lib/ghost-cursor.js';
|
|
9
10
|
export * from './lib/format-bar.js';
|
|
11
|
+
export { materialIcons } from './lib/icons-generated.js';
|
|
10
12
|
export * from './lib/outline.js';
|
|
11
13
|
export * from './lib/reference-list.js';
|
|
12
14
|
export * from './lib/selection-editor.js';
|
|
13
15
|
export * from './lib/theme.js';
|
|
14
16
|
export { defaultCitationSourceAdapter, getCitationSourceAdapter, setCitationSourceAdapter, type CitationItem, type CitationSourceEditorAdapter, type CitationSourceEditorContext, } from './lib/citation-source-adapter.js';
|
|
15
|
-
export { SourceField } from '@sciflow/editor-core';
|
|
16
|
-
export {
|
|
17
|
+
export { SourceField, t, getLocale, setLocale, registerTranslations, LOCALE_CHANGE_EVENT, getCitedReferenceIds, validateDocumentResources, defaultTranslations } from '@sciflow/editor-core';
|
|
18
|
+
export type { MissingResource, TranslationDictionary } from '@sciflow/editor-core';
|
|
19
|
+
export { generateJatsBody } from '@sciflow/schema-prosemirror';
|
|
20
|
+
export type { Locale, TranslationKey } from '@sciflow/editor-core';
|
|
21
|
+
export { citationFeature, crossReferenceFeature, createFigureFeature, listFeature, blockquoteFeature, copyPasteFeature, installMockImageServer, configureImageUploadHandlers, requestImageFile, uploadImageFile, promptForFigureOptions, figureFeature, footnoteFeature, headingFeature, hyperlinkFeature, markFormattingFeature, mathFeature, paragraphFeature, tableFeature, } from '@sciflow/editor-core';
|
|
17
22
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EACL,4BAA4B,EAC5B,wBAAwB,EACxB,wBAAwB,EACxB,KAAK,YAAY,EACjB,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,GACjC,MAAM,kCAAkC,CAAC;AAG1C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EACL,4BAA4B,EAC5B,wBAAwB,EACxB,wBAAwB,EACxB,KAAK,YAAY,EACjB,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,GACjC,MAAM,kCAAkC,CAAC;AAG1C,OAAO,EAAE,WAAW,EAAE,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC7L,YAAY,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,4BAA4B,EAC5B,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACtB,aAAa,EACb,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,WAAW,EACX,gBAAgB,EAChB,YAAY,GACb,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -6,12 +6,15 @@
|
|
|
6
6
|
* bundling strategy used for the demo so integrators have a single import path.
|
|
7
7
|
*/
|
|
8
8
|
export * from './lib/editor-element.js';
|
|
9
|
+
export { ghostCursorFeature } from './lib/ghost-cursor.js';
|
|
9
10
|
export * from './lib/format-bar.js';
|
|
11
|
+
export { materialIcons } from './lib/icons-generated.js';
|
|
10
12
|
export * from './lib/outline.js';
|
|
11
13
|
export * from './lib/reference-list.js';
|
|
12
14
|
export * from './lib/selection-editor.js';
|
|
13
15
|
export * from './lib/theme.js';
|
|
14
16
|
export { defaultCitationSourceAdapter, getCitationSourceAdapter, setCitationSourceAdapter, } from './lib/citation-source-adapter.js';
|
|
15
|
-
// Convenience re-
|
|
16
|
-
export { SourceField } from '@sciflow/editor-core';
|
|
17
|
-
export {
|
|
17
|
+
// Convenience re-exports: allow downstream bundles to pull these from here.
|
|
18
|
+
export { SourceField, t, getLocale, setLocale, registerTranslations, LOCALE_CHANGE_EVENT, getCitedReferenceIds, validateDocumentResources, defaultTranslations } from '@sciflow/editor-core';
|
|
19
|
+
export { generateJatsBody } from '@sciflow/schema-prosemirror';
|
|
20
|
+
export { citationFeature, crossReferenceFeature, createFigureFeature, listFeature, blockquoteFeature, copyPasteFeature, installMockImageServer, configureImageUploadHandlers, requestImageFile, uploadImageFile, promptForFigureOptions, figureFeature, footnoteFeature, headingFeature, hyperlinkFeature, markFormattingFeature, mathFeature, paragraphFeature, tableFeature, } from '@sciflow/editor-core';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"citation-source-adapter.d.ts","sourceRoot":"","sources":["../../src/lib/citation-source-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGzD,YAAY,EAAE,YAAY,EAAE,CAAC;AAE7B;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,
|
|
1
|
+
{"version":3,"file":"citation-source-adapter.d.ts","sourceRoot":"","sources":["../../src/lib/citation-source-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGzD,YAAY,EAAE,YAAY,EAAE,CAAC;AAE7B;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,OAAO,CAAC;IAClD;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAClD;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,uBAAuB,EAAE,CAAC;CACjD;AAED;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;;;OAKG;IACH,MAAM,CACJ,SAAS,EAAE,WAAW,EACtB,KAAK,EAAE,YAAY,EAAE,EACrB,OAAO,EAAE,2BAA2B,GACnC,IAAI,CAAC;IAER;;;;;OAKG;IACH,MAAM,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,OAAO,EAAE,2BAA2B,GAAG,IAAI,CAAC;IAEnG;;;OAGG;IACH,OAAO,CAAC,CAAC,SAAS,EAAE,WAAW,GAAG,IAAI,CAAC;CACxC;AAED;;;GAGG;AACH,eAAO,MAAM,4BAA4B,EAAE,2BAiL1C,CAAC;AAKF;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,2BAA2B,GAAG,IAAI,GAAG,IAAI,CAE1F;AAED;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,2BAA2B,CAEtE"}
|
|
@@ -95,7 +95,7 @@ export const defaultCitationSourceAdapter = {
|
|
|
95
95
|
refs.forEach((ref) => {
|
|
96
96
|
const opt = document.createElement('option');
|
|
97
97
|
opt.value = ref.id;
|
|
98
|
-
opt.textContent = (ref.
|
|
98
|
+
opt.textContent = (ref.rawReference ?? ref.id).trim() || ref.id;
|
|
99
99
|
select.appendChild(opt);
|
|
100
100
|
});
|
|
101
101
|
select.value = refs.some((r) => r.id === currentId) ? currentId : '';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drag-preview.d.ts","sourceRoot":"","sources":["../../src/lib/drag-preview.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,SAAS,EAChB,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GACnE,IAAI,
|
|
1
|
+
{"version":3,"file":"drag-preview.d.ts","sourceRoot":"","sources":["../../src/lib/drag-preview.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,SAAS,EAChB,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GACnE,IAAI,CAsCN"}
|
package/dist/lib/drag-preview.js
CHANGED
|
@@ -7,7 +7,12 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export function setTransparentDragImage(event, options = {}) {
|
|
9
9
|
const transfer = event.dataTransfer;
|
|
10
|
-
|
|
10
|
+
// Prefer currentTarget (the draggable element) over target (the clicked child).
|
|
11
|
+
// When a user clicks a small child element (e.g. a "drag" badge), event.target
|
|
12
|
+
// is that tiny child — cloning it gives near-zero dimensions, which combined with
|
|
13
|
+
// a negative offsetY produces a negative setDragImage y-coordinate that causes
|
|
14
|
+
// browsers to fall back to the default opaque drag image.
|
|
15
|
+
const target = (event.currentTarget ?? event.target);
|
|
11
16
|
if (!transfer || !(target instanceof HTMLElement))
|
|
12
17
|
return;
|
|
13
18
|
const { opacity = 0.5, offsetY = 20, scale = 1 } = options;
|
|
@@ -21,12 +26,14 @@ export function setTransparentDragImage(event, options = {}) {
|
|
|
21
26
|
clone.style.pointerEvents = 'none';
|
|
22
27
|
clone.style.maxWidth = '18rem';
|
|
23
28
|
clone.style.fontSize = '0.65rem';
|
|
29
|
+
clone.style.background = 'transparent';
|
|
30
|
+
clone.style.boxShadow = 'none';
|
|
24
31
|
const root = target.getRootNode();
|
|
25
32
|
const container = root instanceof ShadowRoot ? root : document.body;
|
|
26
33
|
container.appendChild(clone);
|
|
27
34
|
const rect = clone.getBoundingClientRect();
|
|
28
35
|
const x = Math.floor(rect.width / 2);
|
|
29
|
-
const y = Math.floor(rect.height) + offsetY;
|
|
36
|
+
const y = Math.max(0, Math.floor(rect.height) + offsetY);
|
|
30
37
|
try {
|
|
31
38
|
transfer.setDragImage(clone, x, y);
|
|
32
39
|
}
|
|
@@ -27,7 +27,7 @@ import { LitElement } from 'lit';
|
|
|
27
27
|
import type { PropertyValues } from 'lit';
|
|
28
28
|
import type { Node as ProsemirrorNode, ResolvedPos } from 'prosemirror-model';
|
|
29
29
|
import type { PluginKey } from 'prosemirror-state';
|
|
30
|
-
import { Editor, type CommandRunner, type Feature, type Operation, type SciFlowDocJSON, type SnapshotFile, type SnapshotReference, type SelectionJSON, type Version } from '@sciflow/editor-core';
|
|
30
|
+
import { Editor, type CommandRunner, type Feature, type Locale, type Operation, type SciFlowDocJSON, type SnapshotFile, type SnapshotReference, type SelectionJSON, type Version } from '@sciflow/editor-core';
|
|
31
31
|
/**
|
|
32
32
|
* Detail payload emitted with the `editor-change` event.
|
|
33
33
|
* Consumers receive both the latest document snapshot and the batch of
|
|
@@ -59,7 +59,7 @@ export interface PositionAPI {
|
|
|
59
59
|
}
|
|
60
60
|
export interface PluginAPI {
|
|
61
61
|
getState<T>(key: PluginKey<T>): T | null;
|
|
62
|
-
dispatchMeta(key: PluginKey, meta:
|
|
62
|
+
dispatchMeta(key: PluginKey, meta: unknown): boolean;
|
|
63
63
|
}
|
|
64
64
|
export interface DomAPI {
|
|
65
65
|
getBoundingRect(): DOMRect | null;
|
|
@@ -116,6 +116,17 @@ export declare class SciFlowEditorElement extends LitElement {
|
|
|
116
116
|
* Styles are applied to the shadow DOM.
|
|
117
117
|
*/
|
|
118
118
|
editorWidth: 'narrow' | 'wide';
|
|
119
|
+
/**
|
|
120
|
+
* UI locale for all editor components and command metadata.
|
|
121
|
+
* Setting this attribute calls `setLocale()` and triggers a
|
|
122
|
+
* `sciflow-locale-change` event so all components re-render.
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```html
|
|
126
|
+
* <sciflow-editor locale="de"></sciflow-editor>
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
locale: Locale | null;
|
|
119
130
|
private view;
|
|
120
131
|
private editor?;
|
|
121
132
|
private docUnsub?;
|
|
@@ -153,7 +164,7 @@ export declare class SciFlowEditorElement extends LitElement {
|
|
|
153
164
|
/** Get plugin management utilities. */
|
|
154
165
|
get plugins(): {
|
|
155
166
|
getState: <T>(key: PluginKey<T>) => NonNullable<T> | null;
|
|
156
|
-
dispatchMeta: (key: PluginKey, meta:
|
|
167
|
+
dispatchMeta: (key: PluginKey, meta: unknown) => boolean;
|
|
157
168
|
};
|
|
158
169
|
/** Get editor DOM utilities. */
|
|
159
170
|
get dom(): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-element.d.ts","sourceRoot":"","sources":["../../src/lib/editor-element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAwB,UAAU,EAAE,MAAM,KAAK,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAE1C,OAAO,KAAK,EAAE,IAAI,IAAI,eAAe,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EACL,MAAM,
|
|
1
|
+
{"version":3,"file":"editor-element.d.ts","sourceRoot":"","sources":["../../src/lib/editor-element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAwB,UAAU,EAAE,MAAM,KAAK,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAE1C,OAAO,KAAK,EAAE,IAAI,IAAI,eAAe,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EACL,MAAM,EAaN,KAAK,aAAa,EAClB,KAAK,OAAO,EACZ,KAAK,MAAM,EACX,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAElB,KAAK,OAAO,EACb,MAAM,sBAAsB,CAAC;AAM9B;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,GAAG,EAAE,cAAc,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,SAAS,EAAE,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,YAA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;YACW,kBAAkB;IA+BhC;;;;;;;;;;;;;;OAcG;IACH,eAAe,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI;IAY/C,OAAO,CAAC,aAAa;IAarB,OAAO,CAAC,iBAAiB;IAoBzB,OAAO,CAAC,iBAAiB;IA8BzB,OAAO,CAAC,oBAAoB;IAU5B,OAAO,CAAC,qBAAqB;IA6B7B,OAAO,CAAC,mBAAmB;CAW5B;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,oBAAoB,CAAC;KACxC;CACF"}
|
|
@@ -26,9 +26,10 @@
|
|
|
26
26
|
import { __decorate } from "tslib";
|
|
27
27
|
import { css, html, unsafeCSS, LitElement } from 'lit';
|
|
28
28
|
import { customElement, property } from 'lit/decorators.js';
|
|
29
|
-
import { Editor, SourceField, citationFeature, crossReferenceFeature, figureFeature, footnoteFeature, headingFeature, markFormattingFeature, mathFeature, tableFeature, } from '@sciflow/editor-core';
|
|
29
|
+
import { Editor, SourceField, setLocale, citationFeature, crossReferenceFeature, figureFeature, footnoteFeature, headingFeature, hyperlinkFeature, markFormattingFeature, mathFeature, paragraphFeature, tableFeature, } from '@sciflow/editor-core';
|
|
30
30
|
import { manuscript as manuscriptSchema } from '@sciflow/schema-prosemirror';
|
|
31
31
|
import editorStyles from './editor-element.css?inline';
|
|
32
|
+
import { ghostCursorFeature } from './ghost-cursor.js';
|
|
32
33
|
import { applyThemeStylesToRoot, subscribeToSciFlowTheme } from './theme.js';
|
|
33
34
|
/**
|
|
34
35
|
* Custom element that owns a SciFlow editor instance.
|
|
@@ -81,6 +82,17 @@ let SciFlowEditorElement = class SciFlowEditorElement extends LitElement {
|
|
|
81
82
|
* Styles are applied to the shadow DOM.
|
|
82
83
|
*/
|
|
83
84
|
this.editorWidth = 'wide';
|
|
85
|
+
/**
|
|
86
|
+
* UI locale for all editor components and command metadata.
|
|
87
|
+
* Setting this attribute calls `setLocale()` and triggers a
|
|
88
|
+
* `sciflow-locale-change` event so all components re-render.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```html
|
|
92
|
+
* <sciflow-editor locale="de"></sciflow-editor>
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
this.locale = null;
|
|
84
96
|
this.view = null;
|
|
85
97
|
this.pendingOps = [];
|
|
86
98
|
this.pendingOpsFromTransform = false;
|
|
@@ -155,6 +167,9 @@ let SciFlowEditorElement = class SciFlowEditorElement extends LitElement {
|
|
|
155
167
|
}
|
|
156
168
|
connectedCallback() {
|
|
157
169
|
super.connectedCallback();
|
|
170
|
+
if (this.locale) {
|
|
171
|
+
setLocale(this.locale);
|
|
172
|
+
}
|
|
158
173
|
this._hostDragoverBound = (e) => {
|
|
159
174
|
if (!e.dataTransfer?.types || !this.contains(e.target))
|
|
160
175
|
return;
|
|
@@ -196,6 +211,9 @@ let SciFlowEditorElement = class SciFlowEditorElement extends LitElement {
|
|
|
196
211
|
if (changedProperties.has('shadowStyles')) {
|
|
197
212
|
this._shadowStylesAppliedExternally = false;
|
|
198
213
|
}
|
|
214
|
+
if (changedProperties.has('locale') && this.locale) {
|
|
215
|
+
setLocale(this.locale);
|
|
216
|
+
}
|
|
199
217
|
if (changedProperties.has('doc')) {
|
|
200
218
|
this.applyDocUpdate();
|
|
201
219
|
}
|
|
@@ -242,11 +260,14 @@ let SciFlowEditorElement = class SciFlowEditorElement extends LitElement {
|
|
|
242
260
|
citationFeature,
|
|
243
261
|
crossReferenceFeature,
|
|
244
262
|
footnoteFeature,
|
|
263
|
+
hyperlinkFeature,
|
|
245
264
|
markFormattingFeature,
|
|
265
|
+
paragraphFeature,
|
|
246
266
|
headingFeature,
|
|
247
267
|
figureFeature,
|
|
248
268
|
tableFeature,
|
|
249
269
|
mathFeature,
|
|
270
|
+
ghostCursorFeature,
|
|
250
271
|
];
|
|
251
272
|
}
|
|
252
273
|
getActiveFeatures() {
|
|
@@ -752,6 +773,9 @@ __decorate([
|
|
|
752
773
|
__decorate([
|
|
753
774
|
property({ type: String })
|
|
754
775
|
], SciFlowEditorElement.prototype, "editorWidth", void 0);
|
|
776
|
+
__decorate([
|
|
777
|
+
property({ type: String, reflect: true })
|
|
778
|
+
], SciFlowEditorElement.prototype, "locale", void 0);
|
|
755
779
|
SciFlowEditorElement = __decorate([
|
|
756
780
|
customElement('sciflow-editor')
|
|
757
781
|
], SciFlowEditorElement);
|
package/dist/lib/format-bar.d.ts
CHANGED
|
@@ -36,11 +36,15 @@ export declare class SciFlowFormatBarElement extends LitElement {
|
|
|
36
36
|
/** ID reference to resolve an editor instance declaratively. */
|
|
37
37
|
for?: string;
|
|
38
38
|
private selectionVersion;
|
|
39
|
+
private styleMenuOpen;
|
|
40
|
+
private insertMenuOpen;
|
|
39
41
|
private resolvedEditor;
|
|
40
42
|
private selectionListener?;
|
|
41
43
|
private readyListener?;
|
|
44
|
+
private localeListener?;
|
|
42
45
|
private themeUnsub?;
|
|
43
46
|
private themeStyleElements;
|
|
47
|
+
private outsideClickHandler?;
|
|
44
48
|
static styles: import("lit").CSSResult;
|
|
45
49
|
/** Subscribe to editor events once the toolbar attaches to the DOM. */
|
|
46
50
|
connectedCallback(): void;
|
|
@@ -56,6 +60,16 @@ export declare class SciFlowFormatBarElement extends LitElement {
|
|
|
56
60
|
* command runner so the UI stays in sync with the currently loaded features.
|
|
57
61
|
*/
|
|
58
62
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
63
|
+
private renderStyleDropdown;
|
|
64
|
+
private toggleStyleMenu;
|
|
65
|
+
private selectStyle;
|
|
66
|
+
private isBlockquoteActive;
|
|
67
|
+
private canUseCommand;
|
|
68
|
+
private renderInsertDropdown;
|
|
69
|
+
private toggleInsertMenu;
|
|
70
|
+
private executeInsertCommand;
|
|
71
|
+
private installOutsideClickHandler;
|
|
72
|
+
private removeOutsideClickHandler;
|
|
59
73
|
/**
|
|
60
74
|
* Render fixed toolbar commands that are not driven by metadata groups.
|
|
61
75
|
*/
|
|
@@ -70,8 +84,6 @@ export declare class SciFlowFormatBarElement extends LitElement {
|
|
|
70
84
|
private detachEditorListeners;
|
|
71
85
|
/** Convenience getter mirroring `editor.getCommands()`. */
|
|
72
86
|
private getCommandRunner;
|
|
73
|
-
/** Interpret the block-style dropdown and trigger the relevant commands. */
|
|
74
|
-
private handleStyleChange;
|
|
75
87
|
/** Apply a specific heading level after ensuring the editor can handle it. */
|
|
76
88
|
private handleSetHeading;
|
|
77
89
|
/** Reset the current block back to a paragraph. */
|
|
@@ -82,6 +94,11 @@ export declare class SciFlowFormatBarElement extends LitElement {
|
|
|
82
94
|
private canUseStyleOption;
|
|
83
95
|
/** True if the current selection is inside a table (cell or header). */
|
|
84
96
|
private isSelectionInTable;
|
|
97
|
+
/**
|
|
98
|
+
* Render table commands split into logical sub-groups (columns, rows,
|
|
99
|
+
* merge/split, header toggles, navigation/delete) separated visually.
|
|
100
|
+
*/
|
|
101
|
+
private renderTableSubGroups;
|
|
85
102
|
/**
|
|
86
103
|
* Render a set of command buttons that share the same metadata group.
|
|
87
104
|
* Groups are sorted by each command's declared order so feature authors control layout.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-bar.d.ts","sourceRoot":"","sources":["../../src/lib/format-bar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAa,UAAU,
|
|
1
|
+
{"version":3,"file":"format-bar.d.ts","sourceRoot":"","sources":["../../src/lib/format-bar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAa,UAAU,EAAsB,MAAM,KAAK,CAAC;AAOhE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAoChE;;;;;;;;;;;GAWG;AACH,qBACa,uBAAwB,SAAQ,UAAU;IACrD,oFAAoF;IAEpF,MAAM,EAAE,oBAAoB,GAAG,IAAI,CAAQ;IAE3C,gEAAgE;IAEhE,GAAG,CAAC,EAAE,MAA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