roosterjs-content-model-plugins 0.28.2 → 9.0.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/README.md +47 -37
- package/lib/autoFormat/AutoFormatPlugin.d.ts +5 -2
- package/lib/autoFormat/AutoFormatPlugin.js +23 -11
- package/lib/autoFormat/AutoFormatPlugin.js.map +1 -1
- package/lib/autoFormat/link/createLinkAfterSpace.js +28 -22
- package/lib/autoFormat/link/createLinkAfterSpace.js.map +1 -1
- package/lib/autoFormat/link/getLinkSegment.js +2 -2
- package/lib/autoFormat/link/getLinkSegment.js.map +1 -1
- package/lib/autoFormat/list/getListTypeStyle.js +14 -14
- package/lib/autoFormat/list/getListTypeStyle.js.map +1 -1
- package/lib/autoFormat/list/getNumberingListStyle.js +29 -29
- package/lib/autoFormat/list/getNumberingListStyle.js.map +1 -1
- package/lib/autoFormat/list/keyboardListTrigger.d.ts +1 -1
- package/lib/autoFormat/list/keyboardListTrigger.js +10 -11
- package/lib/autoFormat/list/keyboardListTrigger.js.map +1 -1
- package/lib/edit/deleteSteps/deleteAllSegmentBefore.js +2 -2
- package/lib/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
- package/lib/edit/deleteSteps/deleteCollapsedSelection.js +4 -5
- package/lib/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
- package/lib/edit/deleteSteps/deleteEmptyQuote.js +2 -3
- package/lib/edit/deleteSteps/deleteEmptyQuote.js.map +1 -1
- package/lib/edit/deleteSteps/deleteList.js +3 -5
- package/lib/edit/deleteSteps/deleteList.js.map +1 -1
- package/lib/edit/deleteSteps/deleteWordSelection.js +3 -4
- package/lib/edit/deleteSteps/deleteWordSelection.js.map +1 -1
- package/lib/edit/inputSteps/handleEnterOnList.js +2 -3
- package/lib/edit/inputSteps/handleEnterOnList.js.map +1 -1
- package/lib/edit/keyboardDelete.js +4 -5
- package/lib/edit/keyboardDelete.js.map +1 -1
- package/lib/edit/keyboardInput.js +3 -4
- package/lib/edit/keyboardInput.js.map +1 -1
- package/lib/edit/keyboardTab.js +3 -3
- package/lib/edit/keyboardTab.js.map +1 -1
- package/lib/index.d.ts +3 -0
- package/lib/index.js +5 -1
- package/lib/index.js.map +1 -1
- package/lib/markdown/MarkdownPlugin.d.ts +55 -0
- package/lib/markdown/MarkdownPlugin.js +177 -0
- package/lib/markdown/MarkdownPlugin.js.map +1 -0
- package/lib/markdown/utils/setFormat.d.ts +5 -0
- package/lib/markdown/utils/setFormat.js +46 -0
- package/lib/markdown/utils/setFormat.js.map +1 -0
- package/lib/paste/WordDesktop/processWordLists.js +2 -3
- package/lib/paste/WordDesktop/processWordLists.js.map +1 -1
- package/lib/pluginUtils/splitTextSegment.d.ts +5 -0
- package/lib/pluginUtils/splitTextSegment.js +26 -0
- package/lib/pluginUtils/splitTextSegment.js.map +1 -0
- package/lib/shortcut/ShortcutPlugin.js +2 -2
- package/lib/shortcut/ShortcutPlugin.js.map +1 -1
- package/lib/shortcut/utils/setShortcutIndentationCommand.js +2 -2
- package/lib/shortcut/utils/setShortcutIndentationCommand.js.map +1 -1
- package/lib/tableEdit/editors/features/CellResizer.js +5 -6
- package/lib/tableEdit/editors/features/CellResizer.js.map +1 -1
- package/lib/tableEdit/editors/features/TableResizer.js +2 -3
- package/lib/tableEdit/editors/features/TableResizer.js.map +1 -1
- package/lib/watermark/WatermarkFormat.d.ts +5 -0
- package/lib/watermark/WatermarkFormat.js +3 -0
- package/lib/watermark/WatermarkFormat.js.map +1 -0
- package/lib/watermark/WatermarkPlugin.d.ts +37 -0
- package/lib/watermark/WatermarkPlugin.js +99 -0
- package/lib/watermark/WatermarkPlugin.js.map +1 -0
- package/lib/watermark/isModelEmptyFast.d.ts +6 -0
- package/lib/watermark/isModelEmptyFast.js +35 -0
- package/lib/watermark/isModelEmptyFast.js.map +1 -0
- package/lib-amd/autoFormat/AutoFormatPlugin.d.ts +5 -2
- package/lib-amd/autoFormat/AutoFormatPlugin.js +23 -11
- package/lib-amd/autoFormat/AutoFormatPlugin.js.map +1 -1
- package/lib-amd/autoFormat/link/createLinkAfterSpace.js +28 -22
- package/lib-amd/autoFormat/link/createLinkAfterSpace.js.map +1 -1
- package/lib-amd/autoFormat/link/getLinkSegment.js +2 -2
- package/lib-amd/autoFormat/link/getLinkSegment.js.map +1 -1
- package/lib-amd/autoFormat/list/getListTypeStyle.js +14 -14
- package/lib-amd/autoFormat/list/getListTypeStyle.js.map +1 -1
- package/lib-amd/autoFormat/list/getNumberingListStyle.js +29 -29
- package/lib-amd/autoFormat/list/getNumberingListStyle.js.map +1 -1
- package/lib-amd/autoFormat/list/keyboardListTrigger.d.ts +1 -1
- package/lib-amd/autoFormat/list/keyboardListTrigger.js +11 -11
- package/lib-amd/autoFormat/list/keyboardListTrigger.js.map +1 -1
- package/lib-amd/edit/deleteSteps/deleteAllSegmentBefore.js +2 -2
- package/lib-amd/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
- package/lib-amd/edit/deleteSteps/deleteCollapsedSelection.js +5 -5
- package/lib-amd/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
- package/lib-amd/edit/deleteSteps/deleteEmptyQuote.js +3 -3
- package/lib-amd/edit/deleteSteps/deleteEmptyQuote.js.map +1 -1
- package/lib-amd/edit/deleteSteps/deleteList.js +3 -5
- package/lib-amd/edit/deleteSteps/deleteList.js.map +1 -1
- package/lib-amd/edit/deleteSteps/deleteWordSelection.js +4 -4
- package/lib-amd/edit/deleteSteps/deleteWordSelection.js.map +1 -1
- package/lib-amd/edit/inputSteps/handleEnterOnList.js +3 -3
- package/lib-amd/edit/inputSteps/handleEnterOnList.js.map +1 -1
- package/lib-amd/edit/keyboardDelete.js +4 -4
- package/lib-amd/edit/keyboardDelete.js.map +1 -1
- package/lib-amd/edit/keyboardInput.js +3 -3
- package/lib-amd/edit/keyboardInput.js.map +1 -1
- package/lib-amd/edit/keyboardTab.js +3 -3
- package/lib-amd/edit/keyboardTab.js.map +1 -1
- package/lib-amd/index.d.ts +3 -0
- package/lib-amd/index.js +4 -2
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/markdown/MarkdownPlugin.d.ts +55 -0
- package/lib-amd/markdown/MarkdownPlugin.js +178 -0
- package/lib-amd/markdown/MarkdownPlugin.js.map +1 -0
- package/lib-amd/markdown/utils/setFormat.d.ts +5 -0
- package/lib-amd/markdown/utils/setFormat.js +45 -0
- package/lib-amd/markdown/utils/setFormat.js.map +1 -0
- package/lib-amd/paste/WordDesktop/processWordLists.js +3 -3
- package/lib-amd/paste/WordDesktop/processWordLists.js.map +1 -1
- package/lib-amd/pluginUtils/splitTextSegment.d.ts +5 -0
- package/lib-amd/pluginUtils/splitTextSegment.js +26 -0
- package/lib-amd/pluginUtils/splitTextSegment.js.map +1 -0
- package/lib-amd/shortcut/ShortcutPlugin.js +2 -2
- package/lib-amd/shortcut/ShortcutPlugin.js.map +1 -1
- package/lib-amd/shortcut/utils/setShortcutIndentationCommand.js +2 -2
- package/lib-amd/shortcut/utils/setShortcutIndentationCommand.js.map +1 -1
- package/lib-amd/tableEdit/editors/features/CellResizer.js +6 -6
- package/lib-amd/tableEdit/editors/features/CellResizer.js.map +1 -1
- package/lib-amd/tableEdit/editors/features/TableResizer.js +3 -3
- package/lib-amd/tableEdit/editors/features/TableResizer.js.map +1 -1
- package/lib-amd/watermark/WatermarkFormat.d.ts +5 -0
- package/lib-amd/watermark/WatermarkFormat.js +5 -0
- package/lib-amd/watermark/WatermarkFormat.js.map +1 -0
- package/lib-amd/watermark/WatermarkPlugin.d.ts +37 -0
- package/lib-amd/watermark/WatermarkPlugin.js +99 -0
- package/lib-amd/watermark/WatermarkPlugin.js.map +1 -0
- package/lib-amd/watermark/isModelEmptyFast.d.ts +6 -0
- package/lib-amd/watermark/isModelEmptyFast.js +37 -0
- package/lib-amd/watermark/isModelEmptyFast.js.map +1 -0
- package/lib-mjs/autoFormat/AutoFormatPlugin.d.ts +5 -2
- package/lib-mjs/autoFormat/AutoFormatPlugin.js +23 -11
- package/lib-mjs/autoFormat/AutoFormatPlugin.js.map +1 -1
- package/lib-mjs/autoFormat/link/createLinkAfterSpace.js +28 -22
- package/lib-mjs/autoFormat/link/createLinkAfterSpace.js.map +1 -1
- package/lib-mjs/autoFormat/link/getLinkSegment.js +1 -1
- package/lib-mjs/autoFormat/link/getLinkSegment.js.map +1 -1
- package/lib-mjs/autoFormat/list/getListTypeStyle.js +2 -2
- package/lib-mjs/autoFormat/list/getListTypeStyle.js.map +1 -1
- package/lib-mjs/autoFormat/list/getNumberingListStyle.js +1 -1
- package/lib-mjs/autoFormat/list/getNumberingListStyle.js.map +1 -1
- package/lib-mjs/autoFormat/list/keyboardListTrigger.d.ts +1 -1
- package/lib-mjs/autoFormat/list/keyboardListTrigger.js +11 -12
- package/lib-mjs/autoFormat/list/keyboardListTrigger.js.map +1 -1
- package/lib-mjs/edit/deleteSteps/deleteAllSegmentBefore.js +1 -1
- package/lib-mjs/edit/deleteSteps/deleteAllSegmentBefore.js.map +1 -1
- package/lib-mjs/edit/deleteSteps/deleteCollapsedSelection.js +1 -2
- package/lib-mjs/edit/deleteSteps/deleteCollapsedSelection.js.map +1 -1
- package/lib-mjs/edit/deleteSteps/deleteEmptyQuote.js +1 -2
- package/lib-mjs/edit/deleteSteps/deleteEmptyQuote.js.map +1 -1
- package/lib-mjs/edit/deleteSteps/deleteList.js +2 -4
- package/lib-mjs/edit/deleteSteps/deleteList.js.map +1 -1
- package/lib-mjs/edit/deleteSteps/deleteWordSelection.js +1 -2
- package/lib-mjs/edit/deleteSteps/deleteWordSelection.js.map +1 -1
- package/lib-mjs/edit/inputSteps/handleEnterOnList.js +1 -2
- package/lib-mjs/edit/inputSteps/handleEnterOnList.js.map +1 -1
- package/lib-mjs/edit/keyboardDelete.js +1 -2
- package/lib-mjs/edit/keyboardDelete.js.map +1 -1
- package/lib-mjs/edit/keyboardInput.js +1 -2
- package/lib-mjs/edit/keyboardInput.js.map +1 -1
- package/lib-mjs/edit/keyboardTab.js +1 -1
- package/lib-mjs/edit/keyboardTab.js.map +1 -1
- package/lib-mjs/index.d.ts +3 -0
- package/lib-mjs/index.js +2 -0
- package/lib-mjs/index.js.map +1 -1
- package/lib-mjs/markdown/MarkdownPlugin.d.ts +55 -0
- package/lib-mjs/markdown/MarkdownPlugin.js +174 -0
- package/lib-mjs/markdown/MarkdownPlugin.js.map +1 -0
- package/lib-mjs/markdown/utils/setFormat.d.ts +5 -0
- package/lib-mjs/markdown/utils/setFormat.js +42 -0
- package/lib-mjs/markdown/utils/setFormat.js.map +1 -0
- package/lib-mjs/paste/WordDesktop/processWordLists.js +1 -2
- package/lib-mjs/paste/WordDesktop/processWordLists.js.map +1 -1
- package/lib-mjs/pluginUtils/splitTextSegment.d.ts +5 -0
- package/lib-mjs/pluginUtils/splitTextSegment.js +22 -0
- package/lib-mjs/pluginUtils/splitTextSegment.js.map +1 -0
- package/lib-mjs/shortcut/ShortcutPlugin.js +1 -1
- package/lib-mjs/shortcut/ShortcutPlugin.js.map +1 -1
- package/lib-mjs/shortcut/utils/setShortcutIndentationCommand.js +1 -1
- package/lib-mjs/shortcut/utils/setShortcutIndentationCommand.js.map +1 -1
- package/lib-mjs/tableEdit/editors/features/CellResizer.js +1 -2
- package/lib-mjs/tableEdit/editors/features/CellResizer.js.map +1 -1
- package/lib-mjs/tableEdit/editors/features/TableResizer.js +1 -2
- package/lib-mjs/tableEdit/editors/features/TableResizer.js.map +1 -1
- package/lib-mjs/watermark/WatermarkFormat.d.ts +5 -0
- package/lib-mjs/watermark/WatermarkFormat.js +2 -0
- package/lib-mjs/watermark/WatermarkFormat.js.map +1 -0
- package/lib-mjs/watermark/WatermarkPlugin.d.ts +37 -0
- package/lib-mjs/watermark/WatermarkPlugin.js +96 -0
- package/lib-mjs/watermark/WatermarkPlugin.js.map +1 -0
- package/lib-mjs/watermark/isModelEmptyFast.d.ts +6 -0
- package/lib-mjs/watermark/isModelEmptyFast.js +31 -0
- package/lib-mjs/watermark/isModelEmptyFast.js.map +1 -0
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -6,13 +6,17 @@ Rooster is a framework-independent JavaScript rich-text editor neatly nested
|
|
|
6
6
|
inside one HTML `<div>` element. Editing operations performed by end users are
|
|
7
7
|
handled in simple ways to generate the final HTML.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Rooster is working on top of a middle layer data structure called "Content Model".
|
|
10
|
+
All format API and editing operation are using this Content Model layer as content format,
|
|
11
|
+
and finally convert to HTML and show it in editor.
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
To view the demo site, please click the link below:
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
[RoosterJs Demo Site](https://microsoft.github.io/roosterjs/index.html).
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
## Upgrade from RoosterJs 8.\*
|
|
18
|
+
|
|
19
|
+
Please see [here](https://github.com/microsoft/roosterjs/wiki/RoosterJs-9).
|
|
16
20
|
|
|
17
21
|
## Features
|
|
18
22
|
|
|
@@ -25,24 +29,22 @@ Rooster contains 6 basic packages.
|
|
|
25
29
|
`createEditor()` function in roosterjs to create an editor with default
|
|
26
30
|
configurations.
|
|
27
31
|
|
|
28
|
-
2. [roosterjs-
|
|
29
|
-
Defines the core editor and plugin infrastructure. Use `roosterjs-
|
|
32
|
+
2. [roosterjs-content-model-core](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_content_model_core.html):
|
|
33
|
+
Defines the core editor and plugin infrastructure. Use `roosterjs-content-model-core`
|
|
30
34
|
instead of `roosterjs` to build and customize your own editor.
|
|
31
35
|
|
|
32
|
-
3. [roosterjs-
|
|
36
|
+
3. [roosterjs-content-model-api](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_content_model_api.html):
|
|
33
37
|
Defines APIs for editor operations. Use these APIs to modify content and
|
|
34
|
-
formatting in the editor you built using `roosterjs-
|
|
38
|
+
formatting in the editor you built using `roosterjs-content-model-core`.
|
|
35
39
|
|
|
36
|
-
4. [roosterjs-
|
|
37
|
-
Defines APIs for DOM operations.
|
|
38
|
-
you want to access DOM API directly.
|
|
40
|
+
4. [roosterjs-content-model-dom](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_content_model_dom.html):
|
|
41
|
+
Defines APIs for Content Model and DOM operations. This package do conversion between DOM tree and roosterjs Content Model.
|
|
39
42
|
|
|
40
|
-
5. [roosterjs-
|
|
41
|
-
Defines basic plugins for common features.
|
|
42
|
-
pasting HTML content, inserting inline images.
|
|
43
|
+
5. [roosterjs-content-model-plugins](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_content_model_plugins.html):
|
|
44
|
+
Defines basic plugins for common features.
|
|
43
45
|
|
|
44
|
-
6. [roosterjs-
|
|
45
|
-
Defines public interfaces and enumerations.
|
|
46
|
+
6. [roosterjs-content-model-types](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_content_model_types.html):
|
|
47
|
+
Defines public interfaces and enumerations, including Content Model types, API parameters and other types.
|
|
46
48
|
|
|
47
49
|
There are also some extension packages to provide additional functionalities.
|
|
48
50
|
|
|
@@ -52,30 +54,38 @@ There are also some extension packages to provide additional functionalities.
|
|
|
52
54
|
2. [roosterjs-react](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_react.html):
|
|
53
55
|
Provide a React wrapper of roosterjs so it can be easily used with React.
|
|
54
56
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
To be compatible with old (8.\*) versions, you can use `EditorAdapter` class from the following package which can act as a 8.\* Editor:
|
|
58
|
+
|
|
59
|
+
1. [roosterjs-editor-adapter](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_editor_adapter.html):
|
|
60
|
+
Provide a adapter class `EditorAdapter` to work with Editor (9.\*) and legacy plugins (via [EditorAdapterOptions.legacyPlugins](https://microsoft.github.io/roosterjs/docs/interfaces/roosterjs_editor_adapter.editoradapteroptions.html#legacyplugins))
|
|
61
|
+
|
|
62
|
+
And the following packages are for old (8.\*) compatibility:
|
|
63
|
+
|
|
64
|
+
1. [roosterjs-editor-core](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_editor_core.html):
|
|
65
|
+
2. [roosterjs-editor-api](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_editor_api.html):
|
|
66
|
+
3. [roosterjs-editor-dom](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_editor_dom.html):
|
|
67
|
+
4. [roosterjs-editor-plugins](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_editor_plugins.html):
|
|
68
|
+
5. [roosterjs-editor-types](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_editor_types.html):
|
|
69
|
+
6. [roosterjs-editor-types-compatible](https://microsoft.github.io/roosterjs/docs/modules/roosterjs_editor_types_compatible.html):
|
|
59
70
|
|
|
60
71
|
### APIs
|
|
61
72
|
|
|
62
|
-
Rooster provides
|
|
63
|
-
(in `roosterjs-
|
|
73
|
+
Rooster provides Content Model level APIs (in `roosterjs-content-model-dom`), core APIs (in `roosterjs-content-model-core`), and formatting APIs
|
|
74
|
+
(in `roosterjs-content-modelapi`) to perform editing operations.
|
|
64
75
|
|
|
65
|
-
`roosterjs-
|
|
76
|
+
`roosterjs-content-model-dom` provides several levels of Content Model operations:
|
|
66
77
|
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
ContentTraverser API.
|
|
78
|
+
- Create Content Model elements
|
|
79
|
+
- Convert DOM tree to Content Model
|
|
80
|
+
- Convert Content Model to DOM tree
|
|
81
|
+
- Format handlers
|
|
82
|
+
- A few DOM level API
|
|
73
83
|
|
|
74
|
-
`roosterjs-
|
|
75
|
-
APIs to perform basic editor operations. These APIs
|
|
84
|
+
`roosterjs-content-model-core` provides APIs for editor core. Editor class will call such
|
|
85
|
+
APIs to perform basic editor operations. These APIs can be overridden by specifying
|
|
76
86
|
API overrides in Editor options when creating the editor.
|
|
77
87
|
|
|
78
|
-
`roosterjs-
|
|
88
|
+
`roosterjs-content-model-api` provides APIs for scenario-based operations triggered by
|
|
79
89
|
user interaction.
|
|
80
90
|
|
|
81
91
|
## Plugins
|
|
@@ -99,7 +109,7 @@ class HelloRooster implements EditorPlugin {
|
|
|
99
109
|
dispose() {}
|
|
100
110
|
|
|
101
111
|
onPluginEvent(e: PluginEvent) {
|
|
102
|
-
if (e.eventType ==
|
|
112
|
+
if (e.eventType == 'input' && e.rawEvent.which == 65) {
|
|
103
113
|
alert('Hello Rooster');
|
|
104
114
|
}
|
|
105
115
|
}
|
|
@@ -114,9 +124,9 @@ Install via NPM or Yarn:
|
|
|
114
124
|
|
|
115
125
|
You can also install sub packages separately:
|
|
116
126
|
|
|
117
|
-
`yarn add roosterjs-
|
|
127
|
+
`yarn add roosterjs-content-model-core`
|
|
118
128
|
|
|
119
|
-
`yarn add roosterjs-
|
|
129
|
+
`yarn add roosterjs-content-model-api`
|
|
120
130
|
|
|
121
131
|
`...`
|
|
122
132
|
|
|
@@ -161,9 +171,9 @@ In order to run the code below, you may also need to install [webpack](https://w
|
|
|
161
171
|
|
|
162
172
|
## Sample code
|
|
163
173
|
|
|
164
|
-
To view the
|
|
174
|
+
To view the demo site, please click [here](https://microsoft.github.io/roosterjs/index.html).
|
|
165
175
|
|
|
166
|
-
To build the
|
|
176
|
+
To build the demo site code yourself, follow these instructions:
|
|
167
177
|
|
|
168
178
|
1. Get dependencies using [yarn](https://yarnpkg.com) or [npm](https://www.npmjs.com/):
|
|
169
179
|
|
|
@@ -29,8 +29,10 @@ export declare class AutoFormatPlugin implements EditorPlugin {
|
|
|
29
29
|
private editor;
|
|
30
30
|
/**
|
|
31
31
|
* @param options An optional parameter that takes in an object of type AutoFormatOptions, which includes the following properties:
|
|
32
|
-
* - autoBullet: A boolean that enables or disables automatic bullet list formatting. Defaults to
|
|
33
|
-
* - autoNumbering: A boolean that enables or disables automatic numbering formatting. Defaults to
|
|
32
|
+
* - autoBullet: A boolean that enables or disables automatic bullet list formatting. Defaults to false.
|
|
33
|
+
* - autoNumbering: A boolean that enables or disables automatic numbering formatting. Defaults to false.
|
|
34
|
+
* - autoLink: A boolean that enables or disables automatic hyperlink creation when pasting or typing content. Defaults to false.
|
|
35
|
+
* - autoUnlink: A boolean that enables or disables automatic hyperlink removal when pressing backspace. Defaults to false.
|
|
34
36
|
*/
|
|
35
37
|
constructor(options?: AutoFormatOptions);
|
|
36
38
|
/**
|
|
@@ -57,6 +59,7 @@ export declare class AutoFormatPlugin implements EditorPlugin {
|
|
|
57
59
|
* @param event The event to handle:
|
|
58
60
|
*/
|
|
59
61
|
onPluginEvent(event: PluginEvent): void;
|
|
62
|
+
private handleEditorInputEvent;
|
|
60
63
|
private handleKeyDownEvent;
|
|
61
64
|
private handleContentChangedEvent;
|
|
62
65
|
}
|
|
@@ -9,10 +9,10 @@ var unlink_1 = require("./link/unlink");
|
|
|
9
9
|
* @internal
|
|
10
10
|
*/
|
|
11
11
|
var DefaultOptions = {
|
|
12
|
-
autoBullet:
|
|
13
|
-
autoNumbering:
|
|
12
|
+
autoBullet: false,
|
|
13
|
+
autoNumbering: false,
|
|
14
14
|
autoUnlink: false,
|
|
15
|
-
autoLink:
|
|
15
|
+
autoLink: false,
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
18
|
* Auto Format plugin handles auto formatting, such as transforming * characters into a bullet list.
|
|
@@ -21,8 +21,10 @@ var DefaultOptions = {
|
|
|
21
21
|
var AutoFormatPlugin = /** @class */ (function () {
|
|
22
22
|
/**
|
|
23
23
|
* @param options An optional parameter that takes in an object of type AutoFormatOptions, which includes the following properties:
|
|
24
|
-
* - autoBullet: A boolean that enables or disables automatic bullet list formatting. Defaults to
|
|
25
|
-
* - autoNumbering: A boolean that enables or disables automatic numbering formatting. Defaults to
|
|
24
|
+
* - autoBullet: A boolean that enables or disables automatic bullet list formatting. Defaults to false.
|
|
25
|
+
* - autoNumbering: A boolean that enables or disables automatic numbering formatting. Defaults to false.
|
|
26
|
+
* - autoLink: A boolean that enables or disables automatic hyperlink creation when pasting or typing content. Defaults to false.
|
|
27
|
+
* - autoUnlink: A boolean that enables or disables automatic hyperlink removal when pressing backspace. Defaults to false.
|
|
26
28
|
*/
|
|
27
29
|
function AutoFormatPlugin(options) {
|
|
28
30
|
if (options === void 0) { options = DefaultOptions; }
|
|
@@ -61,6 +63,9 @@ var AutoFormatPlugin = /** @class */ (function () {
|
|
|
61
63
|
AutoFormatPlugin.prototype.onPluginEvent = function (event) {
|
|
62
64
|
if (this.editor) {
|
|
63
65
|
switch (event.eventType) {
|
|
66
|
+
case 'input':
|
|
67
|
+
this.handleEditorInputEvent(this.editor, event);
|
|
68
|
+
break;
|
|
64
69
|
case 'keyDown':
|
|
65
70
|
this.handleKeyDownEvent(this.editor, event);
|
|
66
71
|
break;
|
|
@@ -70,19 +75,26 @@ var AutoFormatPlugin = /** @class */ (function () {
|
|
|
70
75
|
}
|
|
71
76
|
}
|
|
72
77
|
};
|
|
73
|
-
AutoFormatPlugin.prototype.
|
|
78
|
+
AutoFormatPlugin.prototype.handleEditorInputEvent = function (editor, event) {
|
|
74
79
|
var rawEvent = event.rawEvent;
|
|
75
|
-
if (
|
|
76
|
-
|
|
77
|
-
switch (rawEvent.key) {
|
|
80
|
+
if (rawEvent.inputType === 'insertText') {
|
|
81
|
+
switch (rawEvent.data) {
|
|
78
82
|
case ' ':
|
|
79
|
-
|
|
83
|
+
var _a = this.options, autoBullet = _a.autoBullet, autoNumbering = _a.autoNumbering, autoLink = _a.autoLink;
|
|
84
|
+
(0, keyboardListTrigger_1.keyboardListTrigger)(editor, autoBullet, autoNumbering);
|
|
80
85
|
if (autoLink) {
|
|
81
86
|
(0, createLinkAfterSpace_1.createLinkAfterSpace)(editor);
|
|
82
87
|
}
|
|
83
88
|
break;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
AutoFormatPlugin.prototype.handleKeyDownEvent = function (editor, event) {
|
|
93
|
+
var rawEvent = event.rawEvent;
|
|
94
|
+
if (!rawEvent.defaultPrevented && !event.handledByEditFeature) {
|
|
95
|
+
switch (rawEvent.key) {
|
|
84
96
|
case 'Backspace':
|
|
85
|
-
if (autoUnlink) {
|
|
97
|
+
if (this.options.autoUnlink) {
|
|
86
98
|
(0, unlink_1.unlink)(editor, rawEvent);
|
|
87
99
|
}
|
|
88
100
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoFormatPlugin.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/autoFormat/AutoFormatPlugin.ts"],"names":[],"mappings":";;;AAAA,gDAA+C;AAC/C,oEAAmE;AACnE,kEAAiE;AACjE,wCAAuC;
|
|
1
|
+
{"version":3,"file":"AutoFormatPlugin.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/autoFormat/AutoFormatPlugin.ts"],"names":[],"mappings":";;;AAAA,gDAA+C;AAC/C,oEAAmE;AACnE,kEAAiE;AACjE,wCAAuC;AAmCvC;;GAEG;AACH,IAAM,cAAc,GAAgC;IAChD,UAAU,EAAE,KAAK;IACjB,aAAa,EAAE,KAAK;IACpB,UAAU,EAAE,KAAK;IACjB,QAAQ,EAAE,KAAK;CAClB,CAAC;AAEF;;;GAGG;AACH;IAGI;;;;;;OAMG;IACH,0BAAoB,OAA2C;QAA3C,wBAAA,EAAA,wBAA2C;QAA3C,YAAO,GAAP,OAAO,CAAoC;QATvD,WAAM,GAAmB,IAAI,CAAC;IAS4B,CAAC;IAEnE;;OAEG;IACH,kCAAO,GAAP;QACI,OAAO,YAAY,CAAC;IACxB,CAAC;IAED;;;;;OAKG;IACH,qCAAU,GAAV,UAAW,MAAe;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACH,kCAAO,GAAP;QACI,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACH,wCAAa,GAAb,UAAc,KAAkB;QAC5B,IAAI,IAAI,CAAC,MAAM,EAAE;YACb,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ACb;SACJ;IACL,CAAC;IAEO,oDAAyB,GAAjC,UAAkC,MAAe,EAAE,KAA0B;QACjE,IAAA,QAAQ,GAAK,IAAI,CAAC,OAAO,SAAjB,CAAkB;QAClC,IAAI,KAAK,CAAC,MAAM,IAAI,OAAO,IAAI,QAAQ,EAAE;YACrC,IAAA,uBAAU,EAAC,MAAM,CAAC,CAAC;SACtB;IACL,CAAC;IACL,uBAAC;AAAD,CAAC,AA9FD,IA8FC;AA9FY,4CAAgB","sourcesContent":["import { createLink } from './link/createLink';\nimport { createLinkAfterSpace } from './link/createLinkAfterSpace';\nimport { keyboardListTrigger } from './list/keyboardListTrigger';\nimport { unlink } from './link/unlink';\nimport type {\n ContentChangedEvent,\n EditorInputEvent,\n EditorPlugin,\n IEditor,\n KeyDownEvent,\n PluginEvent,\n} from 'roosterjs-content-model-types';\n\n/**\n * Options to customize the Content Model Auto Format Plugin\n */\nexport type AutoFormatOptions = {\n /**\n * When true, after type *, ->, -, --, => , —, > and space key a type of bullet list will be triggered. @default true\n */\n autoBullet: boolean;\n\n /**\n * When true, after type 1, A, a, i, I followed by ., ), - or between () and space key a type of numbering list will be triggered. @default true\n */\n autoNumbering: boolean;\n\n /**\n * When press backspace before a link, remove the hyperlink\n */\n autoUnlink: boolean;\n\n /**\n * When paste content, create hyperlink for the pasted link\n */\n autoLink: boolean;\n};\n\n/**\n * @internal\n */\nconst DefaultOptions: Required<AutoFormatOptions> = {\n autoBullet: false,\n autoNumbering: false,\n autoUnlink: false,\n autoLink: false,\n};\n\n/**\n * Auto Format plugin handles auto formatting, such as transforming * characters into a bullet list.\n * It can be customized with options to enable or disable auto list features.\n */\nexport class AutoFormatPlugin implements EditorPlugin {\n private editor: IEditor | null = null;\n\n /**\n * @param options An optional parameter that takes in an object of type AutoFormatOptions, which includes the following properties:\n * - autoBullet: A boolean that enables or disables automatic bullet list formatting. Defaults to false.\n * - autoNumbering: A boolean that enables or disables automatic numbering formatting. Defaults to false.\n * - autoLink: A boolean that enables or disables automatic hyperlink creation when pasting or typing content. Defaults to false.\n * - autoUnlink: A boolean that enables or disables automatic hyperlink removal when pressing backspace. Defaults to false.\n */\n constructor(private options: AutoFormatOptions = DefaultOptions) {}\n\n /**\n * Get name of this plugin\n */\n getName() {\n return 'AutoFormat';\n }\n\n /**\n * The first method that editor will call to a plugin when editor is initializing.\n * It will pass in the editor instance, plugin should take this chance to save the\n * editor reference so that it can call to any editor method or format API later.\n * @param editor The editor object\n */\n initialize(editor: IEditor) {\n this.editor = editor;\n }\n\n /**\n * The last method that editor will call to a plugin before it is disposed.\n * Plugin can take this chance to clear the reference to editor. After this method is\n * called, plugin should not call to any editor method since it will result in error.\n */\n dispose() {\n this.editor = null;\n }\n\n /**\n * Core method for a plugin. Once an event happens in editor, editor will call this\n * method of each plugin to handle the event as long as the event is not handled\n * exclusively by another plugin.\n * @param event The event to handle:\n */\n onPluginEvent(event: PluginEvent) {\n if (this.editor) {\n switch (event.eventType) {\n case 'input':\n this.handleEditorInputEvent(this.editor, event);\n break;\n case 'keyDown':\n this.handleKeyDownEvent(this.editor, event);\n break;\n case 'contentChanged':\n this.handleContentChangedEvent(this.editor, event);\n break;\n }\n }\n }\n\n private handleEditorInputEvent(editor: IEditor, event: EditorInputEvent) {\n const rawEvent = event.rawEvent;\n if (rawEvent.inputType === 'insertText') {\n switch (rawEvent.data) {\n case ' ':\n const { autoBullet, autoNumbering, autoLink } = this.options;\n keyboardListTrigger(editor, autoBullet, autoNumbering);\n if (autoLink) {\n createLinkAfterSpace(editor);\n }\n break;\n }\n }\n }\n\n private handleKeyDownEvent(editor: IEditor, event: KeyDownEvent) {\n const rawEvent = event.rawEvent;\n if (!rawEvent.defaultPrevented && !event.handledByEditFeature) {\n switch (rawEvent.key) {\n case 'Backspace':\n if (this.options.autoUnlink) {\n unlink(editor, rawEvent);\n }\n break;\n }\n }\n }\n\n private handleContentChangedEvent(editor: IEditor, event: ContentChangedEvent) {\n const { autoLink } = this.options;\n if (event.source == 'Paste' && autoLink) {\n createLink(editor);\n }\n }\n}\n"]}
|
|
@@ -2,33 +2,39 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createLinkAfterSpace = void 0;
|
|
4
4
|
var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
|
|
5
|
-
var roosterjs_content_model_core_1 = require("roosterjs-content-model-core");
|
|
6
5
|
var roosterjs_content_model_api_1 = require("roosterjs-content-model-api");
|
|
6
|
+
var splitTextSegment_1 = require("../../pluginUtils/splitTextSegment");
|
|
7
7
|
/**
|
|
8
8
|
* @internal
|
|
9
9
|
*/
|
|
10
10
|
function createLinkAfterSpace(editor) {
|
|
11
|
-
editor.formatContentModel(function (model) {
|
|
12
|
-
var selectedSegmentsAndParagraphs = (0,
|
|
13
|
-
if (selectedSegmentsAndParagraphs
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
textSegment.
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
11
|
+
editor.formatContentModel(function (model, context) {
|
|
12
|
+
var selectedSegmentsAndParagraphs = (0, roosterjs_content_model_dom_1.getSelectedSegmentsAndParagraphs)(model, false /* includingFormatHolder */);
|
|
13
|
+
if (selectedSegmentsAndParagraphs.length > 0 && selectedSegmentsAndParagraphs[0][1]) {
|
|
14
|
+
var markerIndex = selectedSegmentsAndParagraphs[0][1].segments.findIndex(function (segment) { return segment.segmentType == 'SelectionMarker'; });
|
|
15
|
+
var paragraph = selectedSegmentsAndParagraphs[0][1];
|
|
16
|
+
if (markerIndex > 0) {
|
|
17
|
+
var textSegment = paragraph.segments[markerIndex - 1];
|
|
18
|
+
var marker = paragraph.segments[markerIndex];
|
|
19
|
+
if (marker.segmentType == 'SelectionMarker' &&
|
|
20
|
+
textSegment &&
|
|
21
|
+
textSegment.segmentType == 'Text' &&
|
|
22
|
+
!textSegment.link) {
|
|
23
|
+
var link = textSegment.text.split(' ').pop();
|
|
24
|
+
var url = link === null || link === void 0 ? void 0 : link.trim();
|
|
25
|
+
var linkData = null;
|
|
26
|
+
if (url && link && (linkData = (0, roosterjs_content_model_api_1.matchLink)(url))) {
|
|
27
|
+
var linkSegment = (0, splitTextSegment_1.splitTextSegment)(textSegment, paragraph, textSegment.text.length - link.trimLeft().length, textSegment.text.trimRight().length);
|
|
28
|
+
linkSegment.link = {
|
|
29
|
+
format: {
|
|
30
|
+
href: linkData.normalizedUrl,
|
|
31
|
+
underline: true,
|
|
32
|
+
},
|
|
33
|
+
dataset: {},
|
|
34
|
+
};
|
|
35
|
+
context.canUndoByBackspace = true;
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
32
38
|
}
|
|
33
39
|
}
|
|
34
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createLinkAfterSpace.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/autoFormat/link/createLinkAfterSpace.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"createLinkAfterSpace.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/autoFormat/link/createLinkAfterSpace.ts"],"names":[],"mappings":";;;AAAA,2EAA+E;AAC/E,2EAAwD;AACxD,uEAAsE;AAGtE;;GAEG;AACH,SAAgB,oBAAoB,CAAC,MAAe;IAChD,MAAM,CAAC,kBAAkB,CAAC,UAAC,KAAK,EAAE,OAAO;QACrC,IAAM,6BAA6B,GAAG,IAAA,8DAAgC,EAClE,KAAK,EACL,KAAK,CAAC,2BAA2B,CACpC,CAAC;QACF,IAAI,6BAA6B,CAAC,MAAM,GAAG,CAAC,IAAI,6BAA6B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;YACjF,IAAM,WAAW,GAAG,6BAA6B,CA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AAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;wBAElC,OAAO,IAAI,CAAC;qBACf;iBACJ;aACJ;SACJ;QAED,OAAO,KAAK,CAAC;IACjB,CAAC,CAAC,CAAC;AACP,CAAC;AAhDD,oDAgDC","sourcesContent":["import { getSelectedSegmentsAndParagraphs } from 'roosterjs-content-model-dom';\nimport { matchLink } from 'roosterjs-content-model-api';\nimport { splitTextSegment } from '../../pluginUtils/splitTextSegment';\nimport type { IEditor, LinkData } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function createLinkAfterSpace(editor: IEditor) {\n editor.formatContentModel((model, context) => {\n const selectedSegmentsAndParagraphs = getSelectedSegmentsAndParagraphs(\n model,\n false /* includingFormatHolder */\n );\n if (selectedSegmentsAndParagraphs.length > 0 && selectedSegmentsAndParagraphs[0][1]) {\n const markerIndex = selectedSegmentsAndParagraphs[0][1].segments.findIndex(\n segment => segment.segmentType == 'SelectionMarker'\n );\n const paragraph = selectedSegmentsAndParagraphs[0][1];\n if (markerIndex > 0) {\n const textSegment = paragraph.segments[markerIndex - 1];\n const marker = paragraph.segments[markerIndex];\n if (\n marker.segmentType == 'SelectionMarker' &&\n textSegment &&\n textSegment.segmentType == 'Text' &&\n !textSegment.link\n ) {\n const link = textSegment.text.split(' ').pop();\n const url = link?.trim();\n let linkData: LinkData | null = null;\n if (url && link && (linkData = matchLink(url))) {\n const linkSegment = splitTextSegment(\n textSegment,\n paragraph,\n textSegment.text.length - link.trimLeft().length,\n textSegment.text.trimRight().length\n );\n linkSegment.link = {\n format: {\n href: linkData.normalizedUrl,\n underline: true,\n },\n dataset: {},\n };\n\n context.canUndoByBackspace = true;\n\n return true;\n }\n }\n }\n }\n\n return false;\n });\n}\n"]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getLinkSegment = void 0;
|
|
4
|
-
var
|
|
4
|
+
var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
|
|
5
5
|
var roosterjs_content_model_api_1 = require("roosterjs-content-model-api");
|
|
6
6
|
/**
|
|
7
7
|
* @internal
|
|
8
8
|
*/
|
|
9
9
|
function getLinkSegment(model) {
|
|
10
|
-
var selectedSegmentsAndParagraphs = (0,
|
|
10
|
+
var selectedSegmentsAndParagraphs = (0, roosterjs_content_model_dom_1.getSelectedSegmentsAndParagraphs)(model, false /* includingFormatHolder */);
|
|
11
11
|
if (selectedSegmentsAndParagraphs.length == 1 && selectedSegmentsAndParagraphs[0][1]) {
|
|
12
12
|
var selectedParagraph = selectedSegmentsAndParagraphs[0][1];
|
|
13
13
|
var marker = selectedParagraph.segments[selectedParagraph.segments.length - 1];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLinkSegment.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/autoFormat/link/getLinkSegment.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"getLinkSegment.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/autoFormat/link/getLinkSegment.ts"],"names":[],"mappings":";;;AAAA,2EAA+E;AAC/E,2EAAwD;AAGxD;;GAEG;AACH,SAAgB,cAAc,CAAC,KAA2B;IACtD,IAAM,6BAA6B,GAAG,IAAA,8DAAgC,EAClE,KAAK,EACL,KAAK,CAAC,2BAA2B,CACpC,CAAC;IACF,IAAI,6BAA6B,CAAC,MAAM,IAAI,CAAC,IAAI,6BAA6B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;QAClF,IAAM,iBAAiB,GAAG,6BAA6B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9D,IAAM,MAAM,GAAG,iBAAiB,CAAC,QAAQ,CAAC,iBAAiB,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACjF,IAAM,IAAI,GAAG,iBAAiB,CAAC,QAAQ,CAAC,iBAAiB,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC/E,IACI,MAAM;YACN,IAAI;YACJ,MAAM,CAAC,WAAW,KAAK,iBAAiB;YACxC,MAAM,CAAC,UAAU;YACjB,IAAI,CAAC,WAAW,KAAK,MAAM;YAC3B,CAAC,IAAA,uCAAS,EAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,EACrC;YACE,OAAO,IAAI,CAAC;SACf;KACJ;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AArBD,wCAqBC","sourcesContent":["import { getSelectedSegmentsAndParagraphs } from 'roosterjs-content-model-dom';\nimport { matchLink } from 'roosterjs-content-model-api';\nimport type { ContentModelDocument } from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function getLinkSegment(model: ContentModelDocument) {\n const selectedSegmentsAndParagraphs = getSelectedSegmentsAndParagraphs(\n model,\n false /* includingFormatHolder */\n );\n if (selectedSegmentsAndParagraphs.length == 1 && selectedSegmentsAndParagraphs[0][1]) {\n const selectedParagraph = selectedSegmentsAndParagraphs[0][1];\n const marker = selectedParagraph.segments[selectedParagraph.segments.length - 1];\n const link = selectedParagraph.segments[selectedParagraph.segments.length - 2];\n if (\n marker &&\n link &&\n marker.segmentType === 'SelectionMarker' &&\n marker.isSelected &&\n link.segmentType === 'Text' &&\n (matchLink(link.text) || link.link)\n ) {\n return link;\n }\n }\n return undefined;\n}\n"]}
|
|
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getListTypeStyle = void 0;
|
|
4
4
|
var roosterjs_content_model_api_1 = require("roosterjs-content-model-api");
|
|
5
5
|
var getNumberingListStyle_1 = require("./getNumberingListStyle");
|
|
6
|
-
var
|
|
6
|
+
var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
|
|
7
7
|
/**
|
|
8
8
|
* @internal
|
|
9
9
|
*/
|
|
10
10
|
function getListTypeStyle(model, shouldSearchForBullet, shouldSearchForNumbering) {
|
|
11
11
|
if (shouldSearchForBullet === void 0) { shouldSearchForBullet = true; }
|
|
12
12
|
if (shouldSearchForNumbering === void 0) { shouldSearchForNumbering = true; }
|
|
13
|
-
var selectedSegmentsAndParagraphs = (0,
|
|
13
|
+
var selectedSegmentsAndParagraphs = (0, roosterjs_content_model_dom_1.getSelectedSegmentsAndParagraphs)(model, true);
|
|
14
14
|
if (!selectedSegmentsAndParagraphs[0]) {
|
|
15
15
|
return undefined;
|
|
16
16
|
}
|
|
@@ -21,7 +21,7 @@ function getListTypeStyle(model, shouldSearchForBullet, shouldSearchForNumbering
|
|
|
21
21
|
marker.segmentType == 'SelectionMarker' &&
|
|
22
22
|
listMarkerSegment &&
|
|
23
23
|
listMarkerSegment.segmentType == 'Text') {
|
|
24
|
-
var listMarker = listMarkerSegment.text;
|
|
24
|
+
var listMarker = listMarkerSegment.text.trim();
|
|
25
25
|
var bulletType = bulletListType[listMarker];
|
|
26
26
|
if (bulletType && shouldSearchForBullet) {
|
|
27
27
|
return { listType: 'UL', styleType: bulletType };
|
|
@@ -51,14 +51,14 @@ var getPreviousListIndex = function (model, previousListItem) {
|
|
|
51
51
|
return previousListItem ? (0, roosterjs_content_model_api_1.findListItemsInSameThread)(model, previousListItem).length : undefined;
|
|
52
52
|
};
|
|
53
53
|
var getPreviousListLevel = function (model, paragraph) {
|
|
54
|
-
var blocks = (0,
|
|
54
|
+
var blocks = (0, roosterjs_content_model_dom_1.getOperationalBlocks)(model, ['ListItem'], ['TableCell'])[0];
|
|
55
55
|
var listItem = undefined;
|
|
56
56
|
if (blocks) {
|
|
57
57
|
var listBlockIndex = blocks.parent.blocks.indexOf(paragraph);
|
|
58
58
|
if (listBlockIndex > -1) {
|
|
59
59
|
for (var i = listBlockIndex - 1; i > -1; i--) {
|
|
60
60
|
var item = blocks.parent.blocks[i];
|
|
61
|
-
if ((0,
|
|
61
|
+
if ((0, roosterjs_content_model_dom_1.isBlockGroupOfType)(item, 'ListItem')) {
|
|
62
62
|
listItem = item;
|
|
63
63
|
break;
|
|
64
64
|
}
|
|
@@ -70,18 +70,18 @@ var getPreviousListLevel = function (model, paragraph) {
|
|
|
70
70
|
var getPreviousListStyle = function (list) {
|
|
71
71
|
var _a;
|
|
72
72
|
if (list === null || list === void 0 ? void 0 : list.levels[0].dataset) {
|
|
73
|
-
return (_a = (0,
|
|
73
|
+
return (_a = (0, roosterjs_content_model_dom_1.updateListMetadata)(list.levels[0])) === null || _a === void 0 ? void 0 : _a.orderedStyleType;
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
76
|
var bulletListType = {
|
|
77
|
-
'*':
|
|
78
|
-
'-':
|
|
79
|
-
'--':
|
|
80
|
-
'->':
|
|
81
|
-
'-->':
|
|
82
|
-
'=>':
|
|
83
|
-
'>':
|
|
84
|
-
'—':
|
|
77
|
+
'*': roosterjs_content_model_dom_1.BulletListType.Disc,
|
|
78
|
+
'-': roosterjs_content_model_dom_1.BulletListType.Dash,
|
|
79
|
+
'--': roosterjs_content_model_dom_1.BulletListType.Square,
|
|
80
|
+
'->': roosterjs_content_model_dom_1.BulletListType.LongArrow,
|
|
81
|
+
'-->': roosterjs_content_model_dom_1.BulletListType.DoubleLongArrow,
|
|
82
|
+
'=>': roosterjs_content_model_dom_1.BulletListType.UnfilledArrow,
|
|
83
|
+
'>': roosterjs_content_model_dom_1.BulletListType.ShortArrow,
|
|
84
|
+
'—': roosterjs_content_model_dom_1.BulletListType.Hyphen,
|
|
85
85
|
};
|
|
86
86
|
var isNewList = function (listMarker) {
|
|
87
87
|
var marker = listMarker.replace(/[^\w\s]/g, '');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getListTypeStyle.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/autoFormat/list/getListTypeStyle.ts"],"names":[],"mappings":";;;AAAA,2EAAwE;AACxE,iEAAgE;AAMhE,
|
|
1
|
+
{"version":3,"file":"getListTypeStyle.js","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AAC,EAAE;oBAC5D,QAAQ,GAAG,IAAI,CAAC;oBAChB,MAAM;iBACT;aACJ;SACJ;KACJ;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC,CAAC;AAEF,IAAM,oBAAoB,GAAG,UAAC,IAA2B;;IACrD,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE;QACzB,OAAO,MAAA,IAAA,gDAAkB,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,0CAAE,gBAAgB,CAAC;KAC/D;AACL,CAAC,CAAC;AAEF,IAAM,cAAc,GAA2B;IAC3C,GAAG,EAAE,4CAAc,CAAC,IAAI;IACxB,GAAG,EAAE,4CAAc,CAAC,IAAI;IACxB,IAAI,EAAE,4CAAc,CAAC,MAAM;IAC3B,IAAI,EAAE,4CAAc,CAAC,SAAS;IAC9B,KAAK,EAAE,4CAAc,CAAC,eAAe;IACrC,IAAI,EAAE,4CAAc,CAAC,aAAa;IAClC,GAAG,EAAE,4CAAc,CAAC,UAAU;IAC9B,GAAG,EAAE,4CAAc,CAAC,MAAM;CAC7B,CAAC;AAEF,IAAM,SAAS,GAAG,UAAC,UAAkB;IACjC,IAAM,MAAM,GAAG,UAAU,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IAClD,IAAM,OAAO,GAAG,WAAW,CAAC;IAC5B,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC,CAAC","sourcesContent":["import { findListItemsInSameThread } from 'roosterjs-content-model-api';\nimport { getNumberingListStyle } from './getNumberingListStyle';\nimport type {\n ContentModelDocument,\n ContentModelListItem,\n ContentModelParagraph,\n} from 'roosterjs-content-model-types';\nimport {\n BulletListType,\n isBlockGroupOfType,\n updateListMetadata,\n getOperationalBlocks,\n getSelectedSegmentsAndParagraphs,\n} from 'roosterjs-content-model-dom';\n\n/**\n * @internal\n */\ninterface ListTypeStyle {\n listType: 'UL' | 'OL';\n styleType: number;\n index?: number;\n}\n\n/**\n * @internal\n */\nexport function getListTypeStyle(\n model: ContentModelDocument,\n shouldSearchForBullet: boolean = true,\n shouldSearchForNumbering: boolean = true\n): ListTypeStyle | undefined {\n const selectedSegmentsAndParagraphs = getSelectedSegmentsAndParagraphs(model, true);\n if (!selectedSegmentsAndParagraphs[0]) {\n return undefined;\n }\n const marker = selectedSegmentsAndParagraphs[0][0];\n const paragraph = selectedSegmentsAndParagraphs[0][1];\n const listMarkerSegment = paragraph?.segments[0];\n\n if (\n marker &&\n marker.segmentType == 'SelectionMarker' &&\n listMarkerSegment &&\n listMarkerSegment.segmentType == 'Text'\n ) {\n const listMarker = listMarkerSegment.text.trim();\n const bulletType = bulletListType[listMarker];\n\n if (bulletType && shouldSearchForBullet) {\n return { listType: 'UL', styleType: bulletType };\n } else if (shouldSearchForNumbering) {\n const previousList = getPreviousListLevel(model, paragraph);\n const previousIndex = getPreviousListIndex(model, previousList);\n const previousListStyle = getPreviousListStyle(previousList);\n const numberingType = getNumberingListStyle(\n listMarker,\n previousIndex,\n previousListStyle\n );\n\n if (numberingType) {\n return {\n listType: 'OL',\n styleType: numberingType,\n index:\n !isNewList(listMarker) &&\n previousListStyle === numberingType &&\n previousIndex\n ? previousIndex + 1\n : undefined,\n };\n }\n }\n }\n return undefined;\n}\n\nconst getPreviousListIndex = (\n model: ContentModelDocument,\n previousListItem?: ContentModelListItem\n) => {\n return previousListItem ? findListItemsInSameThread(model, previousListItem).length : undefined;\n};\n\nconst getPreviousListLevel = (model: ContentModelDocument, paragraph: ContentModelParagraph) => {\n const blocks = getOperationalBlocks<ContentModelListItem>(\n model,\n ['ListItem'],\n ['TableCell']\n )[0];\n let listItem: ContentModelListItem | undefined = undefined;\n if (blocks) {\n const listBlockIndex = blocks.parent.blocks.indexOf(paragraph);\n\n if (listBlockIndex > -1) {\n for (let i = listBlockIndex - 1; i > -1; i--) {\n const item = blocks.parent.blocks[i];\n if (isBlockGroupOfType<ContentModelListItem>(item, 'ListItem')) {\n listItem = item;\n break;\n }\n }\n }\n }\n\n return listItem;\n};\n\nconst getPreviousListStyle = (list?: ContentModelListItem) => {\n if (list?.levels[0].dataset) {\n return updateListMetadata(list.levels[0])?.orderedStyleType;\n }\n};\n\nconst bulletListType: Record<string, number> = {\n '*': BulletListType.Disc,\n '-': BulletListType.Dash,\n '--': BulletListType.Square,\n '->': BulletListType.LongArrow,\n '-->': BulletListType.DoubleLongArrow,\n '=>': BulletListType.UnfilledArrow,\n '>': BulletListType.ShortArrow,\n '—': BulletListType.Hyphen,\n};\n\nconst isNewList = (listMarker: string) => {\n const marker = listMarker.replace(/[^\\w\\s]/g, '');\n const pattern = /^[1aAiI]$/;\n return pattern.test(marker);\n};\n"]}
|
|
@@ -3,7 +3,7 @@ var _a, _b, _c, _d, _e, _f;
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.getNumberingListStyle = void 0;
|
|
5
5
|
var getIndex_1 = require("./getIndex");
|
|
6
|
-
var
|
|
6
|
+
var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
|
|
7
7
|
var NumberingTypes;
|
|
8
8
|
(function (NumberingTypes) {
|
|
9
9
|
NumberingTypes[NumberingTypes["Decimal"] = 1] = "Decimal";
|
|
@@ -25,16 +25,16 @@ var characters = {
|
|
|
25
25
|
')': 3 /* Parenthesis */,
|
|
26
26
|
};
|
|
27
27
|
var lowerRomanTypes = [
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
roosterjs_content_model_dom_1.NumberingListType.LowerRoman,
|
|
29
|
+
roosterjs_content_model_dom_1.NumberingListType.LowerRomanDash,
|
|
30
|
+
roosterjs_content_model_dom_1.NumberingListType.LowerRomanDoubleParenthesis,
|
|
31
|
+
roosterjs_content_model_dom_1.NumberingListType.LowerRomanParenthesis,
|
|
32
32
|
];
|
|
33
33
|
var upperRomanTypes = [
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
roosterjs_content_model_dom_1.NumberingListType.UpperRoman,
|
|
35
|
+
roosterjs_content_model_dom_1.NumberingListType.UpperRomanDash,
|
|
36
|
+
roosterjs_content_model_dom_1.NumberingListType.UpperRomanDoubleParenthesis,
|
|
37
|
+
roosterjs_content_model_dom_1.NumberingListType.UpperRomanParenthesis,
|
|
38
38
|
];
|
|
39
39
|
var numberingTriggers = ['1', 'a', 'A', 'I', 'i'];
|
|
40
40
|
var lowerRomanNumbers = ['i', 'v', 'x', 'l', 'c', 'd', 'm'];
|
|
@@ -76,34 +76,34 @@ var numberingListTypes = (_a = {},
|
|
|
76
76
|
_a[5 /* UpperRoman */] = function (char) { return UpperRomanTypes[char] || undefined; },
|
|
77
77
|
_a);
|
|
78
78
|
var UpperRomanTypes = (_b = {},
|
|
79
|
-
_b[1 /* Dot */] =
|
|
80
|
-
_b[2 /* Dash */] =
|
|
81
|
-
_b[3 /* Parenthesis */] =
|
|
82
|
-
_b[4 /* DoubleParenthesis */] =
|
|
79
|
+
_b[1 /* Dot */] = roosterjs_content_model_dom_1.NumberingListType.UpperRoman,
|
|
80
|
+
_b[2 /* Dash */] = roosterjs_content_model_dom_1.NumberingListType.UpperRomanDash,
|
|
81
|
+
_b[3 /* Parenthesis */] = roosterjs_content_model_dom_1.NumberingListType.UpperRomanParenthesis,
|
|
82
|
+
_b[4 /* DoubleParenthesis */] = roosterjs_content_model_dom_1.NumberingListType.UpperRomanDoubleParenthesis,
|
|
83
83
|
_b);
|
|
84
84
|
var LowerRomanTypes = (_c = {},
|
|
85
|
-
_c[1 /* Dot */] =
|
|
86
|
-
_c[2 /* Dash */] =
|
|
87
|
-
_c[3 /* Parenthesis */] =
|
|
88
|
-
_c[4 /* DoubleParenthesis */] =
|
|
85
|
+
_c[1 /* Dot */] = roosterjs_content_model_dom_1.NumberingListType.LowerRoman,
|
|
86
|
+
_c[2 /* Dash */] = roosterjs_content_model_dom_1.NumberingListType.LowerRomanDash,
|
|
87
|
+
_c[3 /* Parenthesis */] = roosterjs_content_model_dom_1.NumberingListType.LowerRomanParenthesis,
|
|
88
|
+
_c[4 /* DoubleParenthesis */] = roosterjs_content_model_dom_1.NumberingListType.LowerRomanDoubleParenthesis,
|
|
89
89
|
_c);
|
|
90
90
|
var UpperAlphaTypes = (_d = {},
|
|
91
|
-
_d[1 /* Dot */] =
|
|
92
|
-
_d[2 /* Dash */] =
|
|
93
|
-
_d[3 /* Parenthesis */] =
|
|
94
|
-
_d[4 /* DoubleParenthesis */] =
|
|
91
|
+
_d[1 /* Dot */] = roosterjs_content_model_dom_1.NumberingListType.UpperAlpha,
|
|
92
|
+
_d[2 /* Dash */] = roosterjs_content_model_dom_1.NumberingListType.UpperAlphaDash,
|
|
93
|
+
_d[3 /* Parenthesis */] = roosterjs_content_model_dom_1.NumberingListType.UpperAlphaParenthesis,
|
|
94
|
+
_d[4 /* DoubleParenthesis */] = roosterjs_content_model_dom_1.NumberingListType.UpperAlphaDoubleParenthesis,
|
|
95
95
|
_d);
|
|
96
96
|
var LowerAlphaTypes = (_e = {},
|
|
97
|
-
_e[1 /* Dot */] =
|
|
98
|
-
_e[2 /* Dash */] =
|
|
99
|
-
_e[3 /* Parenthesis */] =
|
|
100
|
-
_e[4 /* DoubleParenthesis */] =
|
|
97
|
+
_e[1 /* Dot */] = roosterjs_content_model_dom_1.NumberingListType.LowerAlpha,
|
|
98
|
+
_e[2 /* Dash */] = roosterjs_content_model_dom_1.NumberingListType.LowerAlphaDash,
|
|
99
|
+
_e[3 /* Parenthesis */] = roosterjs_content_model_dom_1.NumberingListType.LowerAlphaParenthesis,
|
|
100
|
+
_e[4 /* DoubleParenthesis */] = roosterjs_content_model_dom_1.NumberingListType.LowerAlphaDoubleParenthesis,
|
|
101
101
|
_e);
|
|
102
102
|
var DecimalsTypes = (_f = {},
|
|
103
|
-
_f[1 /* Dot */] =
|
|
104
|
-
_f[2 /* Dash */] =
|
|
105
|
-
_f[3 /* Parenthesis */] =
|
|
106
|
-
_f[4 /* DoubleParenthesis */] =
|
|
103
|
+
_f[1 /* Dot */] = roosterjs_content_model_dom_1.NumberingListType.Decimal,
|
|
104
|
+
_f[2 /* Dash */] = roosterjs_content_model_dom_1.NumberingListType.DecimalDash,
|
|
105
|
+
_f[3 /* Parenthesis */] = roosterjs_content_model_dom_1.NumberingListType.DecimalParenthesis,
|
|
106
|
+
_f[4 /* DoubleParenthesis */] = roosterjs_content_model_dom_1.NumberingListType.DecimalDoubleParenthesis,
|
|
107
107
|
_f);
|
|
108
108
|
var identifyNumberingListType = function (numbering, isDoubleParenthesis, previousListStyle) {
|
|
109
109
|
var separatorCharacter = isDoubleParenthesis
|