roosterjs-content-model-plugins 9.7.0 → 9.8.0
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/lib/autoFormat/list/keyboardListTrigger.js +13 -0
- package/lib/autoFormat/list/keyboardListTrigger.js.map +1 -1
- package/lib/imageEdit/ImageEditPlugin.js +4 -0
- package/lib/imageEdit/ImageEditPlugin.js.map +1 -1
- package/lib/imageEdit/utils/normalizeImageSelection.d.ts +9 -0
- package/lib/imageEdit/utils/normalizeImageSelection.js +32 -0
- package/lib/imageEdit/utils/normalizeImageSelection.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -1
- package/lib/index.js.map +1 -1
- package/lib/paste/DefaultSanitizers.d.ts +1 -1
- package/lib/paste/DefaultSanitizers.js +1 -1
- package/lib/paste/DefaultSanitizers.js.map +1 -1
- package/lib-amd/autoFormat/list/keyboardListTrigger.js +12 -1
- package/lib-amd/autoFormat/list/keyboardListTrigger.js.map +1 -1
- package/lib-amd/imageEdit/ImageEditPlugin.js +4 -1
- package/lib-amd/imageEdit/ImageEditPlugin.js.map +1 -1
- package/lib-amd/imageEdit/utils/normalizeImageSelection.d.ts +9 -0
- package/lib-amd/imageEdit/utils/normalizeImageSelection.js +33 -0
- package/lib-amd/imageEdit/utils/normalizeImageSelection.js.map +1 -0
- package/lib-amd/index.d.ts +1 -0
- package/lib-amd/index.js +3 -2
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/paste/DefaultSanitizers.d.ts +1 -1
- package/lib-amd/paste/DefaultSanitizers.js +1 -1
- package/lib-amd/paste/DefaultSanitizers.js.map +1 -1
- package/lib-mjs/autoFormat/list/keyboardListTrigger.js +14 -1
- package/lib-mjs/autoFormat/list/keyboardListTrigger.js.map +1 -1
- package/lib-mjs/imageEdit/ImageEditPlugin.js +4 -0
- package/lib-mjs/imageEdit/ImageEditPlugin.js.map +1 -1
- package/lib-mjs/imageEdit/utils/normalizeImageSelection.d.ts +9 -0
- package/lib-mjs/imageEdit/utils/normalizeImageSelection.js +28 -0
- package/lib-mjs/imageEdit/utils/normalizeImageSelection.js.map +1 -0
- package/lib-mjs/index.d.ts +1 -0
- package/lib-mjs/index.js +1 -0
- package/lib-mjs/index.js.map +1 -1
- package/lib-mjs/paste/DefaultSanitizers.d.ts +1 -1
- package/lib-mjs/paste/DefaultSanitizers.js +1 -1
- package/lib-mjs/paste/DefaultSanitizers.js.map +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ImageAndParagraph } from '../types/ImageAndParagraph';
|
|
2
|
+
/**
|
|
3
|
+
* Selecting directly on the image will only capture the image segment.
|
|
4
|
+
* However, if the selection is made while the image is within a wrapper, it will capture the span that encloses the image.
|
|
5
|
+
* In the last case, the selection will be marked as <---SelectionMarker---><---Image---><---SelectionMarker--->.
|
|
6
|
+
* To fix this behavior the extra selection markers are removed.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare function normalizeImageSelection(imageAndParagraph: ImageAndParagraph): ImageAndParagraph | undefined;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { mutateBlock } from 'roosterjs-content-model-dom';
|
|
2
|
+
/**
|
|
3
|
+
* Selecting directly on the image will only capture the image segment.
|
|
4
|
+
* However, if the selection is made while the image is within a wrapper, it will capture the span that encloses the image.
|
|
5
|
+
* In the last case, the selection will be marked as <---SelectionMarker---><---Image---><---SelectionMarker--->.
|
|
6
|
+
* To fix this behavior the extra selection markers are removed.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export function normalizeImageSelection(imageAndParagraph) {
|
|
10
|
+
var paragraph = imageAndParagraph.paragraph;
|
|
11
|
+
var index = paragraph.segments.indexOf(imageAndParagraph.image);
|
|
12
|
+
if (index > 0) {
|
|
13
|
+
var markerBefore = paragraph.segments[index - 1];
|
|
14
|
+
var markerAfter = paragraph.segments[index + 1];
|
|
15
|
+
if (markerBefore &&
|
|
16
|
+
markerAfter &&
|
|
17
|
+
markerAfter.segmentType == 'SelectionMarker' &&
|
|
18
|
+
markerBefore.segmentType == 'SelectionMarker' &&
|
|
19
|
+
markerAfter.isSelected &&
|
|
20
|
+
markerBefore.isSelected) {
|
|
21
|
+
var mutatedParagraph = mutateBlock(paragraph);
|
|
22
|
+
mutatedParagraph.segments.splice(index - 1, 1);
|
|
23
|
+
mutatedParagraph.segments.splice(index, 1);
|
|
24
|
+
}
|
|
25
|
+
return imageAndParagraph;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=normalizeImageSelection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizeImageSelection.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/imageEdit/utils/normalizeImageSelection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAG1D;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CAAC,iBAAoC;IACxE,IAAM,SAAS,GAAG,iBAAiB,CAAC,SAAS,CAAC;IAC9C,IAAM,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAClE,IAAI,KAAK,GAAG,CAAC,EAAE;QACX,IAAM,YAAY,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QACnD,IAAM,WAAW,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QAClD,IACI,YAAY;YACZ,WAAW;YACX,WAAW,CAAC,WAAW,IAAI,iBAAiB;YAC5C,YAAY,CAAC,WAAW,IAAI,iBAAiB;YAC7C,WAAW,CAAC,UAAU;YACtB,YAAY,CAAC,UAAU,EACzB;YACE,IAAM,gBAAgB,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;YAChD,gBAAgB,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;YAC/C,gBAAgB,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;SAC9C;QACD,OAAO,iBAAiB,CAAC;KAC5B;AACL,CAAC","sourcesContent":["import { mutateBlock } from 'roosterjs-content-model-dom';\nimport type { ImageAndParagraph } from '../types/ImageAndParagraph';\n\n/**\n * Selecting directly on the image will only capture the image segment.\n * However, if the selection is made while the image is within a wrapper, it will capture the span that encloses the image.\n * In the last case, the selection will be marked as <---SelectionMarker---><---Image---><---SelectionMarker--->.\n * To fix this behavior the extra selection markers are removed.\n * @internal\n */\nexport function normalizeImageSelection(imageAndParagraph: ImageAndParagraph) {\n const paragraph = imageAndParagraph.paragraph;\n const index = paragraph.segments.indexOf(imageAndParagraph.image);\n if (index > 0) {\n const markerBefore = paragraph.segments[index - 1];\n const markerAfter = paragraph.segments[index + 1];\n if (\n markerBefore &&\n markerAfter &&\n markerAfter.segmentType == 'SelectionMarker' &&\n markerBefore.segmentType == 'SelectionMarker' &&\n markerAfter.isSelected &&\n markerBefore.isSelected\n ) {\n const mutatedParagraph = mutateBlock(paragraph);\n mutatedParagraph.segments.splice(index - 1, 1);\n mutatedParagraph.segments.splice(index, 1);\n }\n return imageAndParagraph;\n }\n}\n"]}
|
package/lib-mjs/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { TableEditPlugin } from './tableEdit/TableEditPlugin';
|
|
|
2
2
|
export { OnTableEditorCreatedCallback } from './tableEdit/OnTableEditorCreatedCallback';
|
|
3
3
|
export { TableEditFeatureName } from './tableEdit/editors/features/TableEditFeatureName';
|
|
4
4
|
export { PastePlugin } from './paste/PastePlugin';
|
|
5
|
+
export { DefaultSanitizers } from './paste/DefaultSanitizers';
|
|
5
6
|
export { EditPlugin, EditOptions } from './edit/EditPlugin';
|
|
6
7
|
export { AutoFormatPlugin, AutoFormatOptions } from './autoFormat/AutoFormatPlugin';
|
|
7
8
|
export { ShortcutBold, ShortcutItalic, ShortcutUnderline, ShortcutClearFormat, ShortcutUndo, ShortcutUndo2, ShortcutRedo, ShortcutRedoAlt, ShortcutRedoMacOS, ShortcutBullet, ShortcutNumbering, ShortcutIncreaseFont, ShortcutDecreaseFont, ShortcutIndentList, ShortcutOutdentList, } from './shortcut/shortcuts';
|
package/lib-mjs/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { TableEditPlugin } from './tableEdit/TableEditPlugin';
|
|
2
2
|
export { PastePlugin } from './paste/PastePlugin';
|
|
3
|
+
export { DefaultSanitizers } from './paste/DefaultSanitizers';
|
|
3
4
|
export { EditPlugin } from './edit/EditPlugin';
|
|
4
5
|
export { AutoFormatPlugin } from './autoFormat/AutoFormatPlugin';
|
|
5
6
|
export { ShortcutBold, ShortcutItalic, ShortcutUnderline, ShortcutClearFormat, ShortcutUndo, ShortcutUndo2, ShortcutRedo, ShortcutRedoAlt, ShortcutRedoMacOS, ShortcutBullet, ShortcutNumbering, ShortcutIncreaseFont, ShortcutDecreaseFont, ShortcutIndentList, ShortcutOutdentList, } from './shortcut/shortcuts';
|
package/lib-mjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/roosterjs-content-model-plugins/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAe,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAqB,MAAM,+BAA+B,CAAC;AAEpF,OAAO,EACH,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,EAAE,qBAAqB,EAAsB,MAAM,yCAAyC,CAAC;AACpG,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,EAAE,cAAc,EAAmB,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,OAAO,EAAE,mBAAmB,EAAiB,MAAM,qCAAqC,CAAC;AACzF,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC","sourcesContent":["export { TableEditPlugin } from './tableEdit/TableEditPlugin';\nexport { OnTableEditorCreatedCallback } from './tableEdit/OnTableEditorCreatedCallback';\nexport { TableEditFeatureName } from './tableEdit/editors/features/TableEditFeatureName';\nexport { PastePlugin } from './paste/PastePlugin';\nexport { EditPlugin, EditOptions } from './edit/EditPlugin';\nexport { AutoFormatPlugin, AutoFormatOptions } from './autoFormat/AutoFormatPlugin';\n\nexport {\n ShortcutBold,\n ShortcutItalic,\n ShortcutUnderline,\n ShortcutClearFormat,\n ShortcutUndo,\n ShortcutUndo2,\n ShortcutRedo,\n ShortcutRedoAlt,\n ShortcutRedoMacOS,\n ShortcutBullet,\n ShortcutNumbering,\n ShortcutIncreaseFont,\n ShortcutDecreaseFont,\n ShortcutIndentList,\n ShortcutOutdentList,\n} from './shortcut/shortcuts';\nexport { ShortcutPlugin } from './shortcut/ShortcutPlugin';\nexport { ShortcutKeyDefinition, ShortcutCommand } from './shortcut/ShortcutCommand';\nexport { ContextMenuPluginBase, ContextMenuOptions } from './contextMenuBase/ContextMenuPluginBase';\nexport { WatermarkPlugin } from './watermark/WatermarkPlugin';\nexport { WatermarkFormat } from './watermark/WatermarkFormat';\nexport { MarkdownPlugin, MarkdownOptions } from './markdown/MarkdownPlugin';\nexport { HyperlinkPlugin } from './hyperlink/HyperlinkPlugin';\nexport { HyperlinkToolTip } from './hyperlink/HyperlinkToolTip';\nexport { PickerPlugin } from './picker/PickerPlugin';\nexport { PickerHelper } from './picker/PickerHelper';\nexport { PickerSelectionChangMode, PickerDirection, PickerHandler } from './picker/PickerHandler';\nexport { CustomReplacePlugin, CustomReplace } from './customReplace/CustomReplacePlugin';\nexport { ImageEditPlugin } from './imageEdit/ImageEditPlugin';\nexport { ImageEditOptions } from './imageEdit/types/ImageEditOptions';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/roosterjs-content-model-plugins/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAe,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAqB,MAAM,+BAA+B,CAAC;AAEpF,OAAO,EACH,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,EAAE,qBAAqB,EAAsB,MAAM,yCAAyC,CAAC;AACpG,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,EAAE,cAAc,EAAmB,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,OAAO,EAAE,mBAAmB,EAAiB,MAAM,qCAAqC,CAAC;AACzF,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC","sourcesContent":["export { TableEditPlugin } from './tableEdit/TableEditPlugin';\nexport { OnTableEditorCreatedCallback } from './tableEdit/OnTableEditorCreatedCallback';\nexport { TableEditFeatureName } from './tableEdit/editors/features/TableEditFeatureName';\nexport { PastePlugin } from './paste/PastePlugin';\nexport { DefaultSanitizers } from './paste/DefaultSanitizers';\nexport { EditPlugin, EditOptions } from './edit/EditPlugin';\nexport { AutoFormatPlugin, AutoFormatOptions } from './autoFormat/AutoFormatPlugin';\n\nexport {\n ShortcutBold,\n ShortcutItalic,\n ShortcutUnderline,\n ShortcutClearFormat,\n ShortcutUndo,\n ShortcutUndo2,\n ShortcutRedo,\n ShortcutRedoAlt,\n ShortcutRedoMacOS,\n ShortcutBullet,\n ShortcutNumbering,\n ShortcutIncreaseFont,\n ShortcutDecreaseFont,\n ShortcutIndentList,\n ShortcutOutdentList,\n} from './shortcut/shortcuts';\nexport { ShortcutPlugin } from './shortcut/ShortcutPlugin';\nexport { ShortcutKeyDefinition, ShortcutCommand } from './shortcut/ShortcutCommand';\nexport { ContextMenuPluginBase, ContextMenuOptions } from './contextMenuBase/ContextMenuPluginBase';\nexport { WatermarkPlugin } from './watermark/WatermarkPlugin';\nexport { WatermarkFormat } from './watermark/WatermarkFormat';\nexport { MarkdownPlugin, MarkdownOptions } from './markdown/MarkdownPlugin';\nexport { HyperlinkPlugin } from './hyperlink/HyperlinkPlugin';\nexport { HyperlinkToolTip } from './hyperlink/HyperlinkToolTip';\nexport { PickerPlugin } from './picker/PickerPlugin';\nexport { PickerHelper } from './picker/PickerHelper';\nexport { PickerSelectionChangMode, PickerDirection, PickerHandler } from './picker/PickerHandler';\nexport { CustomReplacePlugin, CustomReplace } from './customReplace/CustomReplacePlugin';\nexport { ImageEditPlugin } from './imageEdit/ImageEditPlugin';\nexport { ImageEditOptions } from './imageEdit/types/ImageEditOptions';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultSanitizers.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/paste/DefaultSanitizers.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,IAAM,iBAAiB,GAAmC;IAC7D,KAAK,EAAE,qBAAqB;IAC5B,MAAM,EAAE,qBAAqB;IAC7B,aAAa,EAAE,qBAAqB;IACpC,YAAY,EAAE,qBAAqB;CACtC,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAa,EAAE,OAAe;IAChE,IAAM,GAAG,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAClC,IAAI,GAAG,IAAI,KAAK,IAAI,GAAG,IAAI,GAAG,EAAE;QAC5B,OAAO,IAAI,CAAC;KACf;IACD,OAAO,KAAK,CAAC;AACjB,CAAC","sourcesContent":["import type { ValueSanitizer } from 'roosterjs-content-model-types';\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"DefaultSanitizers.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/paste/DefaultSanitizers.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,IAAM,iBAAiB,GAAmC;IAC7D,KAAK,EAAE,qBAAqB;IAC5B,MAAM,EAAE,qBAAqB;IAC7B,aAAa,EAAE,qBAAqB;IACpC,YAAY,EAAE,qBAAqB;CACtC,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAa,EAAE,OAAe;IAChE,IAAM,GAAG,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAClC,IAAI,GAAG,IAAI,KAAK,IAAI,GAAG,IAAI,GAAG,EAAE;QAC5B,OAAO,IAAI,CAAC;KACf;IACD,OAAO,KAAK,CAAC;AACjB,CAAC","sourcesContent":["import type { ValueSanitizer } from 'roosterjs-content-model-types';\n\n/**\n * Default style sanitizers for PastePlugin.\n */\nexport const DefaultSanitizers: Record<string, ValueSanitizer> = {\n width: divParagraphSanitizer,\n height: divParagraphSanitizer,\n 'inline-size': divParagraphSanitizer,\n 'block-size': divParagraphSanitizer,\n};\n\n/**\n * @internal\n * exported only for unit test\n */\nexport function divParagraphSanitizer(value: string, tagName: string): string | null {\n const tag = tagName.toLowerCase();\n if (tag == 'div' || tag == 'p') {\n return null;\n }\n return value;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
"description": "Plugins for roosterjs",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"tslib": "^2.3.1",
|
|
6
|
-
"roosterjs-content-model-core": "^9.
|
|
7
|
-
"roosterjs-content-model-dom": "^9.
|
|
8
|
-
"roosterjs-content-model-types": "^9.
|
|
9
|
-
"roosterjs-content-model-api": "^9.
|
|
6
|
+
"roosterjs-content-model-core": "^9.8.0",
|
|
7
|
+
"roosterjs-content-model-dom": "^9.8.0",
|
|
8
|
+
"roosterjs-content-model-types": "^9.8.0",
|
|
9
|
+
"roosterjs-content-model-api": "^9.8.0"
|
|
10
10
|
},
|
|
11
|
-
"version": "9.
|
|
11
|
+
"version": "9.8.0",
|
|
12
12
|
"main": "./lib/index.js",
|
|
13
13
|
"typings": "./lib/index.d.ts",
|
|
14
14
|
"module": "./lib-mjs/index.js",
|