@sciflow/editor-start 0.1.0 → 0.1.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/dist/bundle/sciflow-editor.css +1 -1
- package/dist/bundle/sciflow-editor.js +4201 -3973
- package/dist/lib/format-bar.d.ts +7 -0
- package/dist/lib/format-bar.d.ts.map +1 -1
- package/dist/lib/format-bar.js +16 -2
- package/dist/lib/selection-editor.d.ts +103 -2
- package/dist/lib/selection-editor.d.ts.map +1 -1
- package/dist/lib/selection-editor.js +222 -13
- package/package.json +7 -7
- package/dist/lib/default-features.d.ts +0 -21
- package/dist/lib/default-features.d.ts.map +0 -1
- package/dist/lib/default-features.js +0 -34
- package/dist/lib/test-fixtures/soak-documents.d.ts +0 -13
- package/dist/lib/test-fixtures/soak-documents.d.ts.map +0 -1
- package/dist/lib/test-fixtures/soak-documents.js +0 -69
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { bibliographyFeature, citationFeature, crossReferenceFeature, figureFeature, footnoteFeature, headingFeature, hyperlinkFeature, markFormattingFeature, mathFeature, paragraphFeature, tableFeature, } from '@sciflow/editor-core';
|
|
2
|
-
import { ghostCursorFeature } from './ghost-cursor.js';
|
|
3
|
-
/**
|
|
4
|
-
* The feature set `<sciflow-editor>` activates when no `features` property is
|
|
5
|
-
* set. Exported so consumers can *extend* rather than replace the defaults
|
|
6
|
-
* (resolves CHANGEREQUEST #1):
|
|
7
|
-
*
|
|
8
|
-
* ```ts
|
|
9
|
-
* import { DEFAULT_EDITOR_FEATURES } from '@sciflow/editor-start';
|
|
10
|
-
*
|
|
11
|
-
* editor.features = [...DEFAULT_EDITOR_FEATURES, myCustomFeature];
|
|
12
|
-
* ```
|
|
13
|
-
*
|
|
14
|
-
* Lives in its own module (rather than directly in the barrel `index.ts`) so
|
|
15
|
-
* `editor-element.ts` can import it without an `index.ts` → `editor-element.ts`
|
|
16
|
-
* → `index.ts` import cycle; the barrel re-exports it from here.
|
|
17
|
-
*
|
|
18
|
-
* `editor-element.ts`'s private `getDefaultFeatures()` delegates to this
|
|
19
|
-
* constant — keep the two in sync.
|
|
20
|
-
*/
|
|
21
|
-
export const DEFAULT_EDITOR_FEATURES = [
|
|
22
|
-
citationFeature,
|
|
23
|
-
crossReferenceFeature,
|
|
24
|
-
footnoteFeature,
|
|
25
|
-
hyperlinkFeature,
|
|
26
|
-
markFormattingFeature,
|
|
27
|
-
paragraphFeature,
|
|
28
|
-
headingFeature,
|
|
29
|
-
figureFeature,
|
|
30
|
-
tableFeature,
|
|
31
|
-
mathFeature,
|
|
32
|
-
bibliographyFeature,
|
|
33
|
-
ghostCursorFeature,
|
|
34
|
-
];
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { SciFlowDocJSON } from '@sciflow/editor-core';
|
|
2
|
-
type SoakDocSize = {
|
|
3
|
-
headingCount: number;
|
|
4
|
-
paragraphsPerHeading: number;
|
|
5
|
-
wordsPerParagraph: number;
|
|
6
|
-
figureEvery: number;
|
|
7
|
-
};
|
|
8
|
-
export declare const createSoakDocFixture: (size: SoakDocSize) => SciFlowDocJSON;
|
|
9
|
-
export declare const SMALL_SOAK_DOC: SciFlowDocJSON;
|
|
10
|
-
export declare const MEDIUM_SOAK_DOC: SciFlowDocJSON;
|
|
11
|
-
export declare const LARGE_SOAK_DOC: SciFlowDocJSON;
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=soak-documents.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"soak-documents.d.ts","sourceRoot":"","sources":["../../../src/lib/test-fixtures/soak-documents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,KAAK,WAAW,GAAG;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAoCF,eAAO,MAAM,oBAAoB,GAAI,MAAM,WAAW,KAAG,cAwBxD,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,cAK3B,CAAC;AAEH,eAAO,MAAM,eAAe,EAAE,cAK5B,CAAC;AAEH,eAAO,MAAM,cAAc,EAAE,cAK3B,CAAC"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
const WORD = 'sciflow';
|
|
2
|
-
const paragraphText = (wordCount) => Array.from({ length: wordCount }, () => WORD).join(' ');
|
|
3
|
-
const createParagraph = (wordCount) => ({
|
|
4
|
-
type: 'paragraph',
|
|
5
|
-
attrs: { id: null },
|
|
6
|
-
content: [{ type: 'text', text: paragraphText(wordCount) }],
|
|
7
|
-
});
|
|
8
|
-
const createFigure = (id, caption) => ({
|
|
9
|
-
type: 'figure',
|
|
10
|
-
attrs: {
|
|
11
|
-
id,
|
|
12
|
-
src: `https://example.com/${id}.png`,
|
|
13
|
-
alt: caption,
|
|
14
|
-
type: 'figure',
|
|
15
|
-
orientation: 'portrait',
|
|
16
|
-
},
|
|
17
|
-
content: [
|
|
18
|
-
{
|
|
19
|
-
type: 'caption',
|
|
20
|
-
content: [
|
|
21
|
-
{
|
|
22
|
-
type: 'paragraph',
|
|
23
|
-
attrs: { id: null },
|
|
24
|
-
content: [{ type: 'text', text: caption }],
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
});
|
|
30
|
-
export const createSoakDocFixture = (size) => {
|
|
31
|
-
const content = [];
|
|
32
|
-
for (let headingIndex = 0; headingIndex < size.headingCount; headingIndex += 1) {
|
|
33
|
-
const headingId = `section-${headingIndex + 1}`;
|
|
34
|
-
content.push({
|
|
35
|
-
type: 'heading',
|
|
36
|
-
attrs: { level: ((headingIndex % 3) + 1), id: headingId },
|
|
37
|
-
content: [{ type: 'text', text: `Section ${headingIndex + 1}` }],
|
|
38
|
-
});
|
|
39
|
-
for (let paragraphIndex = 0; paragraphIndex < size.paragraphsPerHeading; paragraphIndex += 1) {
|
|
40
|
-
content.push(createParagraph(size.wordsPerParagraph));
|
|
41
|
-
}
|
|
42
|
-
if ((headingIndex + 1) % size.figureEvery === 0) {
|
|
43
|
-
const figureId = `figure-${headingIndex + 1}`;
|
|
44
|
-
content.push(createFigure(figureId, `Figure for ${headingId}`));
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return {
|
|
48
|
-
type: 'doc',
|
|
49
|
-
content,
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
export const SMALL_SOAK_DOC = createSoakDocFixture({
|
|
53
|
-
headingCount: 6,
|
|
54
|
-
paragraphsPerHeading: 2,
|
|
55
|
-
wordsPerParagraph: 25,
|
|
56
|
-
figureEvery: 3,
|
|
57
|
-
});
|
|
58
|
-
export const MEDIUM_SOAK_DOC = createSoakDocFixture({
|
|
59
|
-
headingCount: 20,
|
|
60
|
-
paragraphsPerHeading: 4,
|
|
61
|
-
wordsPerParagraph: 40,
|
|
62
|
-
figureEvery: 2,
|
|
63
|
-
});
|
|
64
|
-
export const LARGE_SOAK_DOC = createSoakDocFixture({
|
|
65
|
-
headingCount: 60,
|
|
66
|
-
paragraphsPerHeading: 6,
|
|
67
|
-
wordsPerParagraph: 50,
|
|
68
|
-
figureEvery: 2,
|
|
69
|
-
});
|