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
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.keyboardListTrigger = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
4
5
|
var getListTypeStyle_1 = require("./getListTypeStyle");
|
|
6
|
+
var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
|
|
5
7
|
var roosterjs_content_model_api_1 = require("roosterjs-content-model-api");
|
|
6
8
|
/**
|
|
7
9
|
* @internal
|
|
@@ -15,6 +17,7 @@ function keyboardListTrigger(model, paragraph, context, shouldSearchForBullet, s
|
|
|
15
17
|
var listType = listStyleType.listType, styleType = listStyleType.styleType, index = listStyleType.index;
|
|
16
18
|
triggerList(model, listType, styleType, index);
|
|
17
19
|
context.canUndoByBackspace = true;
|
|
20
|
+
setAnnounceData(model, context);
|
|
18
21
|
return true;
|
|
19
22
|
}
|
|
20
23
|
return false;
|
|
@@ -29,9 +32,19 @@ var triggerList = function (model, listType, styleType, index) {
|
|
|
29
32
|
(0, roosterjs_content_model_api_1.setModelListStyle)(model, isOrderedList
|
|
30
33
|
? {
|
|
31
34
|
orderedStyleType: styleType,
|
|
35
|
+
applyListStyleFromLevel: false,
|
|
32
36
|
}
|
|
33
37
|
: {
|
|
34
38
|
unorderedStyleType: styleType,
|
|
39
|
+
applyListStyleFromLevel: false,
|
|
35
40
|
});
|
|
36
41
|
};
|
|
42
|
+
function setAnnounceData(model, context) {
|
|
43
|
+
var _a = (0, tslib_1.__read)((0, roosterjs_content_model_dom_1.getOperationalBlocks)(model, ['ListItem'], [] // Set stop types to be empty so we can find list items even cross the boundary of table, then we can always operation on the list item if any
|
|
44
|
+
), 1), paragraphOrListItems = _a[0];
|
|
45
|
+
if (paragraphOrListItems && (0, roosterjs_content_model_dom_1.isBlockGroupOfType)(paragraphOrListItems.block, 'ListItem')) {
|
|
46
|
+
var path = paragraphOrListItems.path, block = paragraphOrListItems.block;
|
|
47
|
+
context.announceData = (0, roosterjs_content_model_api_1.getListAnnounceData)((0, tslib_1.__spreadArray)([block], (0, tslib_1.__read)(path), false));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
37
50
|
//# sourceMappingURL=keyboardListTrigger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboardListTrigger.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/autoFormat/list/keyboardListTrigger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"keyboardListTrigger.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/autoFormat/list/keyboardListTrigger.ts"],"names":[],"mappings":";;;;AAAA,uDAAsD;AACtD,2EAAuF;AACvF,2EAKqC;AAQrC;;GAEG;AACH,SAAgB,mBAAmB,CAC/B,KAAmC,EACnC,SAA8C,EAC9C,OAAkC,EAClC,qBAAqC,EACrC,wBAAwC;IADxC,sCAAA,EAAA,4BAAqC;IACrC,yCAAA,EAAA,+BAAwC;IAExC,IAAM,aAAa,GAAG,IAAA,mCAAgB,EAAC,KAAK,EAAE,qBAAqB,EAAE,wBAAwB,CAAC,CAAC;IAC/F,IAAI,aAAa,EAAE;QACf,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACxB,IAAA,QAAQ,GAAuB,aAAa,SAApC,EAAE,SAAS,GAAY,aAAa,UAAzB,EAAE,KAAK,GAAK,aAAa,MAAlB,CAAmB;QACrD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cesContent":["import { getListTypeStyle } from './getListTypeStyle';\nimport { getOperationalBlocks, isBlockGroupOfType } from 'roosterjs-content-model-dom';\nimport {\n getListAnnounceData,\n setListType,\n setModelListStartNumber,\n setModelListStyle,\n} from 'roosterjs-content-model-api';\nimport type {\n ContentModelListItem,\n FormatContentModelContext,\n ReadonlyContentModelDocument,\n ShallowMutableContentModelParagraph,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function keyboardListTrigger(\n model: ReadonlyContentModelDocument,\n paragraph: ShallowMutableContentModelParagraph,\n context: FormatContentModelContext,\n shouldSearchForBullet: boolean = true,\n shouldSearchForNumbering: boolean = true\n) {\n const listStyleType = getListTypeStyle(model, shouldSearchForBullet, shouldSearchForNumbering);\n if (listStyleType) {\n paragraph.segments.splice(0, 1);\n const { listType, styleType, index } = listStyleType;\n triggerList(model, listType, styleType, index);\n context.canUndoByBackspace = true;\n setAnnounceData(model, context);\n\n return true;\n }\n return false;\n}\n\nconst triggerList = (\n model: ReadonlyContentModelDocument,\n listType: 'OL' | 'UL',\n styleType: number,\n index?: number\n) => {\n setListType(model, listType);\n const isOrderedList = listType == 'OL';\n if (index && index > 1 && isOrderedList) {\n setModelListStartNumber(model, index);\n }\n setModelListStyle(\n model,\n isOrderedList\n ? {\n orderedStyleType: styleType,\n applyListStyleFromLevel: false,\n }\n : {\n unorderedStyleType: styleType,\n applyListStyleFromLevel: false,\n }\n );\n};\nfunction setAnnounceData(model: ReadonlyContentModelDocument, context: FormatContentModelContext) {\n const [paragraphOrListItems] = getOperationalBlocks<ContentModelListItem>(\n model,\n ['ListItem'],\n [] // Set stop types to be empty so we can find list items even cross the boundary of table, then we can always operation on the list item if any\n );\n\n if (paragraphOrListItems && isBlockGroupOfType(paragraphOrListItems.block, 'ListItem')) {\n const { path, block } = paragraphOrListItems;\n context.announceData = getListAnnounceData([block, ...path]);\n }\n}\n"]}
|
|
@@ -13,6 +13,7 @@ var getHTMLImageOptions_1 = require("./utils/getHTMLImageOptions");
|
|
|
13
13
|
var getSelectedImage_1 = require("./utils/getSelectedImage");
|
|
14
14
|
var updateImageEditInfo_1 = require("./utils/updateImageEditInfo");
|
|
15
15
|
var ImageEditElementClass_1 = require("./types/ImageEditElementClass");
|
|
16
|
+
var normalizeImageSelection_1 = require("./utils/normalizeImageSelection");
|
|
16
17
|
var resizerContext_1 = require("./Resizer/resizerContext");
|
|
17
18
|
var rotatorContext_1 = require("./Rotator/rotatorContext");
|
|
18
19
|
var updateRotateHandle_1 = require("./Rotator/updateRotateHandle");
|
|
@@ -195,6 +196,9 @@ var ImageEditPlugin = /** @class */ (function () {
|
|
|
195
196
|
image.isSelected = shouldSelectImage;
|
|
196
197
|
image.isSelectedAsImageSelection = shouldSelectImage;
|
|
197
198
|
});
|
|
199
|
+
if (shouldSelectImage) {
|
|
200
|
+
(0, normalizeImageSelection_1.normalizeImageSelection)(previousSelectedImage);
|
|
201
|
+
}
|
|
198
202
|
_this.cleanInfo();
|
|
199
203
|
result = true;
|
|
200
204
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageEditPlugin.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/imageEdit/ImageEditPlugin.ts"],"names":[],"mappings":";;;;AAAA,mDAAkD;AAClD,iEAAgE;AAChE,yDAA+E;AAC/E,iEAAgE;AAChE,2DAAmD;AACnD,6DAA4D;AAC5D,uEAAsE;AACtE,mEAAkE;AAClE,6DAA4D;AAC5D,mEAA4F;AAC5F,uEAAsE;AACtE,2DAAmD;AACnD,2DAAmD;AACnD,mEAAkE;AAClE,uDAAsD;AAEtD,2EAOqC;AAiBrC,IAAM,cAAc,GAA8B;IAC9C,WAAW,EAAE,SAAS;IACtB,QAAQ,EAAE,EAAE;IACZ,SAAS,EAAE,EAAE;IACb,aAAa,EAAE,IAAI;IACnB,aAAa,EAAE,KAAK;IACpB,iBAAiB,EAAE,KAAK;IACxB,aAAa,EAAE,CAAC,QAAQ,EAAE,QAAQ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EAAE,EAAE,EAAE,UAAA,aAAa;gBAChD,aAAa,CAAC,QAAQ,GAAG,CAAC,aAAa,CAAC,QAAQ,IAAI,CAAC,CAAC,GAAG,QAAQ,CAAC;YACtE,CAAC,CAAC,CAAC;SACN;IACL,CAAC;IAGD,sBAAW,2CAAc;QADzB,uBAAuB;aACvB;YACI,OAAO,IAAI,CAAC,SAAS,CAAC;QAC1B,CAAC;;;OAAA;IACL,sBAAC;AAAD,CAAC,AA7kBD,IA6kBC;AA7kBY,0CAAe","sourcesContent":["import { applyChange } from './utils/applyChange';\nimport { canRegenerateImage } from './utils/canRegenerateImage';\nimport { checkIfImageWasResized, isASmallImage } from './utils/imageEditUtils';\nimport { createImageWrapper } from './utils/createImageWrapper';\nimport { Cropper } from './Cropper/cropperContext';\nimport { findEditingImage } from './utils/findEditingImage';\nimport { getDropAndDragHelpers } from './utils/getDropAndDragHelpers';\nimport { getHTMLImageOptions } from './utils/getHTMLImageOptions';\nimport { getSelectedImage } from './utils/getSelectedImage';\nimport { getSelectedImageMetadata, updateImageEditInfo } from './utils/updateImageEditInfo';\nimport { ImageEditElementClass } from './types/ImageEditElementClass';\nimport { Resizer } from './Resizer/resizerContext';\nimport { Rotator } from './Rotator/rotatorContext';\nimport { updateRotateHandle } from './Rotator/updateRotateHandle';\nimport { updateWrapper } from './utils/updateWrapper';\n\nimport {\n isElementOfType,\n isModifierKey,\n isNodeOfType,\n mutateSegment,\n toArray,\n unwrap,\n} from 'roosterjs-content-model-dom';\nimport type { DragAndDropHelper } from '../pluginUtils/DragAndDrop/DragAndDropHelper';\nimport type { DragAndDropContext } from './types/DragAndDropContext';\nimport type { ImageHtmlOptions } from './types/ImageHtmlOptions';\nimport type { ImageEditOptions } from './types/ImageEditOptions';\nimport type {\n ContentModelImage,\n EditorPlugin,\n IEditor,\n ImageEditOperation,\n ImageEditor,\n ImageMetadataFormat,\n KeyDownEvent,\n MouseUpEvent,\n PluginEvent,\n} from 'roosterjs-content-model-types';\n\nconst DefaultOptions: Partial<ImageEditOptions> = {\n borderColor: '#DB626C',\n minWidth: 10,\n minHeight: 10,\n preserveRatio: true,\n disableRotate: false,\n disableSideResize: false,\n onSelectState: ['resize', 'rotate'],\n};\n\nconst MouseRightButton = 2;\n\n/**\n * ImageEdit plugin handles the following image editing features:\n * - Resize image\n * - Crop image\n * - Rotate image\n * - Flip image\n */\nexport class ImageEditPlugin implements ImageEditor, EditorPlugin {\n protected editor: IEditor | null = null;\n private shadowSpan: HTMLSpanElement | null = null;\n private selectedImage: HTMLImageElement | null = null;\n protected wrapper: HTMLSpanElement | null = null;\n private imageEditInfo: ImageMetadataFormat | null = null;\n private imageHTMLOptions: ImageHtmlOptions | null = null;\n private dndHelpers: DragAndDropHelper<DragAndDropContext, any>[] = [];\n private clonedImage: HTMLImageElement | null = null;\n private lastSrc: string | null = null;\n private wasImageResized: boolean = false;\n private isCropMode: boolean = false;\n private resizers: HTMLDivElement[] = [];\n private rotators: HTMLDivElement[] = [];\n private croppers: HTMLDivElement[] = [];\n private zoomScale: number = 1;\n private disposer: (() => void) | null = null;\n //EXPOSED FOR TEST ONLY\n protected isEditing = false;\n\n constructor(protected options: ImageEditOptions = DefaultOptions) {}\n\n /**\n * Get name of this plugin\n */\n getName() {\n return 'ImageEdit';\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 this.disposer = editor.attachDomEvent({\n blur: {\n beforeDispatch: () => {\n if (this.editor) {\n this.applyFormatWithContentModel(\n this.editor,\n this.isCropMode,\n true /* shouldSelectImage */\n );\n }\n },\n },\n });\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 this.isEditing = false;\n this.cleanInfo();\n if (this.disposer) {\n this.disposer();\n this.disposer = null;\n }\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 return;\n }\n switch (event.eventType) {\n case 'mouseUp':\n this.mouseUpHandler(this.editor, event);\n break;\n case 'keyDown':\n this.keyDownHandler(this.editor, event);\n break;\n }\n }\n\n private isImageSelection(target: Node) {\n return (\n isNodeOfType(target, 'ELEMENT_NODE') &&\n (isElementOfType(target, 'img') ||\n !!(\n isElementOfType(target, 'span') &&\n target.firstElementChild &&\n isNodeOfType(target.firstElementChild, 'ELEMENT_NODE') &&\n isElementOfType(target.firstElementChild, 'img')\n ))\n );\n }\n\n private mouseUpHandler(editor: IEditor, event: MouseUpEvent) {\n const selection = editor.getDOMSelection();\n if ((selection && selection.type == 'image') || this.isEditing) {\n const shouldSelectImage =\n this.isImageSelection(event.rawEvent.target as Node) &&\n event.rawEvent.button === MouseRightButton;\n this.applyFormatWithContentModel(editor, this.isCropMode, shouldSelectImage);\n }\n }\n\n //Sometimes the cursor can be inside the editing image and inside shadow dom, then the cursor need to moved out of shadow dom\n private selectBeforeEditingImage(editor: IEditor, element: HTMLElement) {\n let parent = element.parentNode;\n if (parent && isNodeOfType(parent, 'ELEMENT_NODE') && parent.shadowRoot) {\n element = parent;\n parent = parent.parentNode;\n }\n const index = parent && toArray(parent.childNodes).indexOf(element);\n if (index !== null && index >= 0 && parent) {\n const doc = editor.getDocument();\n const range = doc.createRange();\n range.setStart(parent, index);\n range.collapse();\n editor.setDOMSelection({\n type: 'range',\n range,\n isReverted: false,\n });\n }\n }\n\n private keyDownHandler(editor: IEditor, event: KeyDownEvent) {\n if (this.isEditing) {\n if (event.rawEvent.key === 'Escape') {\n this.removeImageWrapper();\n } else {\n const selection = editor.getDOMSelection();\n const isImageSelection = selection?.type == 'image';\n if (isImageSelection) {\n this.selectBeforeEditingImage(editor, selection.image);\n }\n this.applyFormatWithContentModel(\n editor,\n this.isCropMode,\n (isModifierKey(event.rawEvent) || event.rawEvent.shiftKey) && isImageSelection //if it's a modifier key over a image, the image should select the image\n );\n }\n }\n }\n\n private applyFormatWithContentModel(\n editor: IEditor,\n isCropMode: boolean,\n shouldSelectImage: boolean,\n isApiOperation?: boolean\n ) {\n let editingImageModel: ContentModelImage | undefined;\n const selection = editor.getDOMSelection();\n editor.formatContentModel(\n model => {\n const editingImage = getSelectedImage(model);\n const previousSelectedImage = isApiOperation\n ? editingImage\n : findEditingImage(model);\n\n let result = false;\n if (\n shouldSelectImage ||\n previousSelectedImage?.image != editingImage?.image ||\n previousSelectedImage?.image.dataset.isEditing ||\n isApiOperation\n ) {\n const { lastSrc, selectedImage, imageEditInfo, clonedImage } = this;\n if (\n (this.isEditing || isApiOperation) &&\n previousSelectedImage &&\n lastSrc &&\n selectedImage &&\n imageEditInfo &&\n clonedImage\n ) {\n mutateSegment(\n previousSelectedImage.paragraph,\n previousSelectedImage.image,\n image => {\n applyChange(\n editor,\n selectedImage,\n image,\n imageEditInfo,\n lastSrc,\n this.wasImageResized || this.isCropMode,\n clonedImage\n );\n delete image.dataset.isEditing;\n image.isSelected = shouldSelectImage;\n image.isSelectedAsImageSelection = shouldSelectImage;\n }\n );\n this.cleanInfo();\n result = true;\n }\n\n this.isEditing = false;\n this.isCropMode = false;\n\n if (\n editingImage &&\n selection?.type == 'image' &&\n !shouldSelectImage &&\n !isApiOperation\n ) {\n this.isEditing = true;\n this.isCropMode = isCropMode;\n mutateSegment(editingImage.paragraph, editingImage.image, image => {\n editingImageModel = image;\n this.imageEditInfo = updateImageEditInfo(image, selection.image);\n image.dataset.isEditing = 'true';\n });\n\n result = true;\n }\n }\n\n return result;\n },\n {\n onNodeCreated: (model, node) => {\n if (\n !isApiOperation &&\n editingImageModel &&\n editingImageModel == model &&\n editingImageModel.dataset.isEditing &&\n isNodeOfType(node, 'ELEMENT_NODE') &&\n isElementOfType(node, 'img')\n ) {\n if (isCropMode) {\n this.startCropMode(editor, node);\n } else {\n this.startRotateAndResize(editor, node);\n }\n }\n },\n },\n {\n tryGetFromCache: true,\n }\n );\n }\n\n private startEditing(\n editor: IEditor,\n image: HTMLImageElement,\n apiOperation: ImageEditOperation[]\n ) {\n if (!this.imageEditInfo) {\n this.imageEditInfo = getSelectedImageMetadata(editor, image);\n }\n this.lastSrc = image.getAttribute('src');\n this.imageHTMLOptions = getHTMLImageOptions(editor, this.options, this.imageEditInfo);\n const {\n resizers,\n rotators,\n wrapper,\n shadowSpan,\n imageClone,\n croppers,\n } = createImageWrapper(\n editor,\n image,\n this.options,\n this.imageEditInfo,\n this.imageHTMLOptions,\n apiOperation\n );\n this.shadowSpan = shadowSpan;\n this.selectedImage = image;\n this.wrapper = wrapper;\n this.clonedImage = imageClone;\n this.wasImageResized = checkIfImageWasResized(image);\n this.resizers = resizers;\n this.rotators = rotators;\n this.croppers = croppers;\n this.zoomScale = editor.getDOMHelper().calculateZoomScale();\n\n editor.setEditorStyle('imageEdit', `outline-style:none!important;`, [\n `span:has(>img#${this.selectedImage.id})`,\n ]);\n }\n\n public startRotateAndResize(editor: IEditor, image: HTMLImageElement) {\n if (this.imageEditInfo) {\n this.startEditing(editor, image, ['resize', 'rotate']);\n if (this.selectedImage && this.imageEditInfo && this.wrapper && this.clonedImage) {\n this.dndHelpers = [\n ...getDropAndDragHelpers(\n this.wrapper,\n this.imageEditInfo,\n this.options,\n ImageEditElementClass.ResizeHandle,\n Resizer,\n () => {\n if (\n this.imageEditInfo &&\n this.selectedImage &&\n this.wrapper &&\n this.clonedImage\n ) {\n updateWrapper(\n this.imageEditInfo,\n this.options,\n this.selectedImage,\n this.clonedImage,\n this.wrapper,\n this.resizers\n );\n this.wasImageResized = true;\n }\n },\n this.zoomScale\n ),\n ...getDropAndDragHelpers(\n this.wrapper,\n this.imageEditInfo,\n this.options,\n ImageEditElementClass.RotateHandle,\n Rotator,\n () => {\n if (\n this.imageEditInfo &&\n this.selectedImage &&\n this.wrapper &&\n this.clonedImage\n ) {\n updateWrapper(\n this.imageEditInfo,\n this.options,\n this.selectedImage,\n this.clonedImage,\n this.wrapper\n );\n this.updateRotateHandleState(\n editor,\n this.selectedImage,\n this.wrapper,\n this.rotators,\n this.imageEditInfo?.angleRad\n );\n }\n },\n this.zoomScale\n ),\n ];\n\n updateWrapper(\n this.imageEditInfo,\n this.options,\n this.selectedImage,\n this.clonedImage,\n this.wrapper,\n this.resizers\n );\n\n this.updateRotateHandleState(\n editor,\n this.selectedImage,\n this.wrapper,\n this.rotators,\n this.imageEditInfo?.angleRad\n );\n }\n }\n }\n\n private updateRotateHandleState(\n editor: IEditor,\n image: HTMLImageElement,\n wrapper: HTMLSpanElement,\n rotators: HTMLDivElement[],\n angleRad: number | undefined\n ) {\n const viewport = editor.getVisibleViewport();\n const smallImage = isASmallImage(image.width, image.height);\n if (viewport && rotators && rotators.length > 0) {\n const rotator = rotators[0];\n const rotatorHandle = rotator.firstElementChild;\n if (\n isNodeOfType(rotatorHandle, 'ELEMENT_NODE') &&\n isElementOfType(rotatorHandle, 'div')\n ) {\n updateRotateHandle(\n viewport,\n angleRad ?? 0,\n wrapper,\n rotator,\n rotatorHandle,\n smallImage\n );\n }\n }\n }\n\n public isOperationAllowed(operation: ImageEditOperation): boolean {\n return (\n operation === 'resize' ||\n operation === 'rotate' ||\n operation === 'flip' ||\n operation === 'crop'\n );\n }\n\n public canRegenerateImage(image: HTMLImageElement): boolean {\n return canRegenerateImage(image);\n }\n\n private startCropMode(editor: IEditor, image: HTMLImageElement) {\n if (this.imageEditInfo) {\n this.startEditing(editor, image, ['crop']);\n if (this.imageEditInfo && this.selectedImage && this.wrapper && this.clonedImage) {\n this.dndHelpers = [\n ...getDropAndDragHelpers(\n this.wrapper,\n this.imageEditInfo,\n this.options,\n ImageEditElementClass.CropHandle,\n Cropper,\n () => {\n if (\n this.imageEditInfo &&\n this.selectedImage &&\n this.wrapper &&\n this.clonedImage\n ) {\n updateWrapper(\n this.imageEditInfo,\n this.options,\n this.selectedImage,\n this.clonedImage,\n this.wrapper,\n undefined,\n this.croppers\n );\n this.isCropMode = true;\n }\n },\n this.zoomScale\n ),\n ];\n updateWrapper(\n this.imageEditInfo,\n this.options,\n this.selectedImage,\n this.clonedImage,\n this.wrapper,\n undefined,\n this.croppers\n );\n }\n }\n }\n\n public cropImage() {\n if (!this.editor) {\n return;\n }\n if (!this.editor.getEnvironment().isSafari) {\n this.editor.focus(); // Safari will keep the selection when click crop, then the focus() call should not be called\n }\n const selection = this.editor.getDOMSelection();\n if (selection?.type == 'image') {\n this.applyFormatWithContentModel(\n this.editor,\n true /* isCropMode */,\n false /* shouldSelectImage */\n );\n }\n }\n\n private editImage(\n editor: IEditor,\n image: HTMLImageElement,\n apiOperation: ImageEditOperation[],\n operation: (imageEditInfo: ImageMetadataFormat) => void\n ) {\n this.startEditing(editor, image, apiOperation);\n if (!this.selectedImage || !this.imageEditInfo || !this.wrapper || !this.clonedImage) {\n return;\n }\n\n operation(this.imageEditInfo);\n\n updateWrapper(\n this.imageEditInfo,\n this.options,\n this.selectedImage,\n this.clonedImage,\n this.wrapper\n );\n\n this.applyFormatWithContentModel(\n editor,\n false /* isCrop */,\n true /* shouldSelect*/,\n true /* isApiOperation */\n );\n }\n\n private cleanInfo() {\n this.editor?.setEditorStyle('imageEdit', null);\n this.selectedImage = null;\n this.shadowSpan = null;\n this.wrapper = null;\n this.imageEditInfo = null;\n this.imageHTMLOptions = null;\n this.dndHelpers.forEach(helper => helper.dispose());\n this.dndHelpers = [];\n this.clonedImage = null;\n this.lastSrc = null;\n this.wasImageResized = false;\n this.isCropMode = false;\n this.resizers = [];\n this.rotators = [];\n this.croppers = [];\n }\n\n private removeImageWrapper() {\n let image: HTMLImageElement | null = null;\n if (this.shadowSpan && this.shadowSpan.parentElement) {\n if (\n this.shadowSpan.firstElementChild &&\n isNodeOfType(this.shadowSpan.firstElementChild, 'ELEMENT_NODE') &&\n isElementOfType(this.shadowSpan.firstElementChild, 'img')\n ) {\n image = this.shadowSpan.firstElementChild;\n }\n unwrap(this.shadowSpan);\n this.shadowSpan = null;\n this.wrapper = null;\n }\n\n return image;\n }\n\n public flipImage(direction: 'horizontal' | 'vertical') {\n const selection = this.editor?.getDOMSelection();\n if (!this.editor || !selection || selection.type !== 'image') {\n return;\n }\n const image = selection.image;\n if (this.editor) {\n this.editImage(this.editor, image, ['flip'], imageEditInfo => {\n const angleRad = imageEditInfo.angleRad || 0;\n const isInVerticalPostion =\n (angleRad >= Math.PI / 2 && angleRad < (3 * Math.PI) / 4) ||\n (angleRad <= -Math.PI / 2 && angleRad > (-3 * Math.PI) / 4);\n if (isInVerticalPostion) {\n if (direction === 'horizontal') {\n imageEditInfo.flippedVertical = !imageEditInfo.flippedVertical;\n } else {\n imageEditInfo.flippedHorizontal = !imageEditInfo.flippedHorizontal;\n }\n } else {\n if (direction === 'vertical') {\n imageEditInfo.flippedVertical = !imageEditInfo.flippedVertical;\n } else {\n imageEditInfo.flippedHorizontal = !imageEditInfo.flippedHorizontal;\n }\n }\n });\n }\n }\n\n public rotateImage(angleRad: number) {\n const selection = this.editor?.getDOMSelection();\n if (!this.editor || !selection || selection.type !== 'image') {\n return;\n }\n const image = selection.image;\n if (this.editor) {\n this.editImage(this.editor, image, [], imageEditInfo => {\n imageEditInfo.angleRad = (imageEditInfo.angleRad || 0) + angleRad;\n });\n }\n }\n\n //EXPOSED FOR TEST ONLY\n public get isEditingImage() {\n return this.isEditing;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ImageEditPlugin.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/imageEdit/ImageEditPlugin.ts"],"names":[],"mappings":";;;;AAAA,mDAAkD;AAClD,iEAAgE;AAChE,yDAA+E;AAC/E,iEAAgE;AAChE,2DAAmD;AACnD,6DAA4D;AAC5D,uEAAsE;AACtE,mEAAkE;AAClE,6DAA4D;AAC5D,mEAA4F;AAC5F,uEAAsE;AACtE,2EAA0E;AAC1E,2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AEM,qCAAW,GAAlB,UAAmB,QAAgB;;QAC/B,IAAM,SAAS,GAAG,MAAA,IAAI,CAAC,MAAM,0CAAE,eAAe,EAAE,CAAC;QACjD,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,IAAI,KAAK,OAAO,EAAE;YAC1D,OAAO;SACV;QACD,IAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC;QAC9B,IAAI,IAAI,CAAC,MAAM,EAAE;YACb,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,UAAA,aAAa;gBAChD,aAAa,CAAC,QAAQ,GAAG,CAAC,aAAa,CAAC,QAAQ,IAAI,CAAC,CAAC,GAAG,QAAQ,CAAC;YACtE,CAAC,CAAC,CAAC;SACN;IACL,CAAC;IAGD,sBAAW,2CAAc;QADzB,uBAAuB;aACvB;YACI,OAAO,IAAI,CAAC,SAAS,CAAC;QAC1B,CAAC;;;OAAA;IACL,sBAAC;AAAD,CAAC,AAhlBD,IAglBC;AAhlBY,0CAAe","sourcesContent":["import { applyChange } from './utils/applyChange';\nimport { canRegenerateImage } from './utils/canRegenerateImage';\nimport { checkIfImageWasResized, isASmallImage } from './utils/imageEditUtils';\nimport { createImageWrapper } from './utils/createImageWrapper';\nimport { Cropper } from './Cropper/cropperContext';\nimport { findEditingImage } from './utils/findEditingImage';\nimport { getDropAndDragHelpers } from './utils/getDropAndDragHelpers';\nimport { getHTMLImageOptions } from './utils/getHTMLImageOptions';\nimport { getSelectedImage } from './utils/getSelectedImage';\nimport { getSelectedImageMetadata, updateImageEditInfo } from './utils/updateImageEditInfo';\nimport { ImageEditElementClass } from './types/ImageEditElementClass';\nimport { normalizeImageSelection } from './utils/normalizeImageSelection';\nimport { Resizer } from './Resizer/resizerContext';\nimport { Rotator } from './Rotator/rotatorContext';\nimport { updateRotateHandle } from './Rotator/updateRotateHandle';\nimport { updateWrapper } from './utils/updateWrapper';\n\nimport {\n isElementOfType,\n isModifierKey,\n isNodeOfType,\n mutateSegment,\n toArray,\n unwrap,\n} from 'roosterjs-content-model-dom';\nimport type { DragAndDropHelper } from '../pluginUtils/DragAndDrop/DragAndDropHelper';\nimport type { DragAndDropContext } from './types/DragAndDropContext';\nimport type { ImageHtmlOptions } from './types/ImageHtmlOptions';\nimport type { ImageEditOptions } from './types/ImageEditOptions';\nimport type {\n ContentModelImage,\n EditorPlugin,\n IEditor,\n ImageEditOperation,\n ImageEditor,\n ImageMetadataFormat,\n KeyDownEvent,\n MouseUpEvent,\n PluginEvent,\n} from 'roosterjs-content-model-types';\n\nconst DefaultOptions: Partial<ImageEditOptions> = {\n borderColor: '#DB626C',\n minWidth: 10,\n minHeight: 10,\n preserveRatio: true,\n disableRotate: false,\n disableSideResize: false,\n onSelectState: ['resize', 'rotate'],\n};\n\nconst MouseRightButton = 2;\n\n/**\n * ImageEdit plugin handles the following image editing features:\n * - Resize image\n * - Crop image\n * - Rotate image\n * - Flip image\n */\nexport class ImageEditPlugin implements ImageEditor, EditorPlugin {\n protected editor: IEditor | null = null;\n private shadowSpan: HTMLSpanElement | null = null;\n private selectedImage: HTMLImageElement | null = null;\n protected wrapper: HTMLSpanElement | null = null;\n private imageEditInfo: ImageMetadataFormat | null = null;\n private imageHTMLOptions: ImageHtmlOptions | null = null;\n private dndHelpers: DragAndDropHelper<DragAndDropContext, any>[] = [];\n private clonedImage: HTMLImageElement | null = null;\n private lastSrc: string | null = null;\n private wasImageResized: boolean = false;\n private isCropMode: boolean = false;\n private resizers: HTMLDivElement[] = [];\n private rotators: HTMLDivElement[] = [];\n private croppers: HTMLDivElement[] = [];\n private zoomScale: number = 1;\n private disposer: (() => void) | null = null;\n //EXPOSED FOR TEST ONLY\n protected isEditing = false;\n\n constructor(protected options: ImageEditOptions = DefaultOptions) {}\n\n /**\n * Get name of this plugin\n */\n getName() {\n return 'ImageEdit';\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 this.disposer = editor.attachDomEvent({\n blur: {\n beforeDispatch: () => {\n if (this.editor) {\n this.applyFormatWithContentModel(\n this.editor,\n this.isCropMode,\n true /* shouldSelectImage */\n );\n }\n },\n },\n });\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 this.isEditing = false;\n this.cleanInfo();\n if (this.disposer) {\n this.disposer();\n this.disposer = null;\n }\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 return;\n }\n switch (event.eventType) {\n case 'mouseUp':\n this.mouseUpHandler(this.editor, event);\n break;\n case 'keyDown':\n this.keyDownHandler(this.editor, event);\n break;\n }\n }\n\n private isImageSelection(target: Node) {\n return (\n isNodeOfType(target, 'ELEMENT_NODE') &&\n (isElementOfType(target, 'img') ||\n !!(\n isElementOfType(target, 'span') &&\n target.firstElementChild &&\n isNodeOfType(target.firstElementChild, 'ELEMENT_NODE') &&\n isElementOfType(target.firstElementChild, 'img')\n ))\n );\n }\n\n private mouseUpHandler(editor: IEditor, event: MouseUpEvent) {\n const selection = editor.getDOMSelection();\n if ((selection && selection.type == 'image') || this.isEditing) {\n const shouldSelectImage =\n this.isImageSelection(event.rawEvent.target as Node) &&\n event.rawEvent.button === MouseRightButton;\n this.applyFormatWithContentModel(editor, this.isCropMode, shouldSelectImage);\n }\n }\n\n //Sometimes the cursor can be inside the editing image and inside shadow dom, then the cursor need to moved out of shadow dom\n private selectBeforeEditingImage(editor: IEditor, element: HTMLElement) {\n let parent = element.parentNode;\n if (parent && isNodeOfType(parent, 'ELEMENT_NODE') && parent.shadowRoot) {\n element = parent;\n parent = parent.parentNode;\n }\n const index = parent && toArray(parent.childNodes).indexOf(element);\n if (index !== null && index >= 0 && parent) {\n const doc = editor.getDocument();\n const range = doc.createRange();\n range.setStart(parent, index);\n range.collapse();\n editor.setDOMSelection({\n type: 'range',\n range,\n isReverted: false,\n });\n }\n }\n\n private keyDownHandler(editor: IEditor, event: KeyDownEvent) {\n if (this.isEditing) {\n if (event.rawEvent.key === 'Escape') {\n this.removeImageWrapper();\n } else {\n const selection = editor.getDOMSelection();\n const isImageSelection = selection?.type == 'image';\n if (isImageSelection) {\n this.selectBeforeEditingImage(editor, selection.image);\n }\n this.applyFormatWithContentModel(\n editor,\n this.isCropMode,\n (isModifierKey(event.rawEvent) || event.rawEvent.shiftKey) && isImageSelection //if it's a modifier key over a image, the image should select the image\n );\n }\n }\n }\n\n private applyFormatWithContentModel(\n editor: IEditor,\n isCropMode: boolean,\n shouldSelectImage: boolean,\n isApiOperation?: boolean\n ) {\n let editingImageModel: ContentModelImage | undefined;\n const selection = editor.getDOMSelection();\n editor.formatContentModel(\n model => {\n const editingImage = getSelectedImage(model);\n const previousSelectedImage = isApiOperation\n ? editingImage\n : findEditingImage(model);\n\n let result = false;\n if (\n shouldSelectImage ||\n previousSelectedImage?.image != editingImage?.image ||\n previousSelectedImage?.image.dataset.isEditing ||\n isApiOperation\n ) {\n const { lastSrc, selectedImage, imageEditInfo, clonedImage } = this;\n if (\n (this.isEditing || isApiOperation) &&\n previousSelectedImage &&\n lastSrc &&\n selectedImage &&\n imageEditInfo &&\n clonedImage\n ) {\n mutateSegment(\n previousSelectedImage.paragraph,\n previousSelectedImage.image,\n image => {\n applyChange(\n editor,\n selectedImage,\n image,\n imageEditInfo,\n lastSrc,\n this.wasImageResized || this.isCropMode,\n clonedImage\n );\n delete image.dataset.isEditing;\n image.isSelected = shouldSelectImage;\n image.isSelectedAsImageSelection = shouldSelectImage;\n }\n );\n if (shouldSelectImage) {\n normalizeImageSelection(previousSelectedImage);\n }\n this.cleanInfo();\n result = true;\n }\n\n this.isEditing = false;\n this.isCropMode = false;\n\n if (\n editingImage &&\n selection?.type == 'image' &&\n !shouldSelectImage &&\n !isApiOperation\n ) {\n this.isEditing = true;\n this.isCropMode = isCropMode;\n mutateSegment(editingImage.paragraph, editingImage.image, image => {\n editingImageModel = image;\n this.imageEditInfo = updateImageEditInfo(image, selection.image);\n image.dataset.isEditing = 'true';\n });\n\n result = true;\n }\n }\n\n return result;\n },\n {\n onNodeCreated: (model, node) => {\n if (\n !isApiOperation &&\n editingImageModel &&\n editingImageModel == model &&\n editingImageModel.dataset.isEditing &&\n isNodeOfType(node, 'ELEMENT_NODE') &&\n isElementOfType(node, 'img')\n ) {\n if (isCropMode) {\n this.startCropMode(editor, node);\n } else {\n this.startRotateAndResize(editor, node);\n }\n }\n },\n },\n {\n tryGetFromCache: true,\n }\n );\n }\n\n private startEditing(\n editor: IEditor,\n image: HTMLImageElement,\n apiOperation: ImageEditOperation[]\n ) {\n if (!this.imageEditInfo) {\n this.imageEditInfo = getSelectedImageMetadata(editor, image);\n }\n this.lastSrc = image.getAttribute('src');\n this.imageHTMLOptions = getHTMLImageOptions(editor, this.options, this.imageEditInfo);\n const {\n resizers,\n rotators,\n wrapper,\n shadowSpan,\n imageClone,\n croppers,\n } = createImageWrapper(\n editor,\n image,\n this.options,\n this.imageEditInfo,\n this.imageHTMLOptions,\n apiOperation\n );\n this.shadowSpan = shadowSpan;\n this.selectedImage = image;\n this.wrapper = wrapper;\n this.clonedImage = imageClone;\n this.wasImageResized = checkIfImageWasResized(image);\n this.resizers = resizers;\n this.rotators = rotators;\n this.croppers = croppers;\n this.zoomScale = editor.getDOMHelper().calculateZoomScale();\n\n editor.setEditorStyle('imageEdit', `outline-style:none!important;`, [\n `span:has(>img#${this.selectedImage.id})`,\n ]);\n }\n\n public startRotateAndResize(editor: IEditor, image: HTMLImageElement) {\n if (this.imageEditInfo) {\n this.startEditing(editor, image, ['resize', 'rotate']);\n if (this.selectedImage && this.imageEditInfo && this.wrapper && this.clonedImage) {\n this.dndHelpers = [\n ...getDropAndDragHelpers(\n this.wrapper,\n this.imageEditInfo,\n this.options,\n ImageEditElementClass.ResizeHandle,\n Resizer,\n () => {\n if (\n this.imageEditInfo &&\n this.selectedImage &&\n this.wrapper &&\n this.clonedImage\n ) {\n updateWrapper(\n this.imageEditInfo,\n this.options,\n this.selectedImage,\n this.clonedImage,\n this.wrapper,\n this.resizers\n );\n this.wasImageResized = true;\n }\n },\n this.zoomScale\n ),\n ...getDropAndDragHelpers(\n this.wrapper,\n this.imageEditInfo,\n this.options,\n ImageEditElementClass.RotateHandle,\n Rotator,\n () => {\n if (\n this.imageEditInfo &&\n this.selectedImage &&\n this.wrapper &&\n this.clonedImage\n ) {\n updateWrapper(\n this.imageEditInfo,\n this.options,\n this.selectedImage,\n this.clonedImage,\n this.wrapper\n );\n this.updateRotateHandleState(\n editor,\n this.selectedImage,\n this.wrapper,\n this.rotators,\n this.imageEditInfo?.angleRad\n );\n }\n },\n this.zoomScale\n ),\n ];\n\n updateWrapper(\n this.imageEditInfo,\n this.options,\n this.selectedImage,\n this.clonedImage,\n this.wrapper,\n this.resizers\n );\n\n this.updateRotateHandleState(\n editor,\n this.selectedImage,\n this.wrapper,\n this.rotators,\n this.imageEditInfo?.angleRad\n );\n }\n }\n }\n\n private updateRotateHandleState(\n editor: IEditor,\n image: HTMLImageElement,\n wrapper: HTMLSpanElement,\n rotators: HTMLDivElement[],\n angleRad: number | undefined\n ) {\n const viewport = editor.getVisibleViewport();\n const smallImage = isASmallImage(image.width, image.height);\n if (viewport && rotators && rotators.length > 0) {\n const rotator = rotators[0];\n const rotatorHandle = rotator.firstElementChild;\n if (\n isNodeOfType(rotatorHandle, 'ELEMENT_NODE') &&\n isElementOfType(rotatorHandle, 'div')\n ) {\n updateRotateHandle(\n viewport,\n angleRad ?? 0,\n wrapper,\n rotator,\n rotatorHandle,\n smallImage\n );\n }\n }\n }\n\n public isOperationAllowed(operation: ImageEditOperation): boolean {\n return (\n operation === 'resize' ||\n operation === 'rotate' ||\n operation === 'flip' ||\n operation === 'crop'\n );\n }\n\n public canRegenerateImage(image: HTMLImageElement): boolean {\n return canRegenerateImage(image);\n }\n\n private startCropMode(editor: IEditor, image: HTMLImageElement) {\n if (this.imageEditInfo) {\n this.startEditing(editor, image, ['crop']);\n if (this.imageEditInfo && this.selectedImage && this.wrapper && this.clonedImage) {\n this.dndHelpers = [\n ...getDropAndDragHelpers(\n this.wrapper,\n this.imageEditInfo,\n this.options,\n ImageEditElementClass.CropHandle,\n Cropper,\n () => {\n if (\n this.imageEditInfo &&\n this.selectedImage &&\n this.wrapper &&\n this.clonedImage\n ) {\n updateWrapper(\n this.imageEditInfo,\n this.options,\n this.selectedImage,\n this.clonedImage,\n this.wrapper,\n undefined,\n this.croppers\n );\n this.isCropMode = true;\n }\n },\n this.zoomScale\n ),\n ];\n updateWrapper(\n this.imageEditInfo,\n this.options,\n this.selectedImage,\n this.clonedImage,\n this.wrapper,\n undefined,\n this.croppers\n );\n }\n }\n }\n\n public cropImage() {\n if (!this.editor) {\n return;\n }\n if (!this.editor.getEnvironment().isSafari) {\n this.editor.focus(); // Safari will keep the selection when click crop, then the focus() call should not be called\n }\n const selection = this.editor.getDOMSelection();\n if (selection?.type == 'image') {\n this.applyFormatWithContentModel(\n this.editor,\n true /* isCropMode */,\n false /* shouldSelectImage */\n );\n }\n }\n\n private editImage(\n editor: IEditor,\n image: HTMLImageElement,\n apiOperation: ImageEditOperation[],\n operation: (imageEditInfo: ImageMetadataFormat) => void\n ) {\n this.startEditing(editor, image, apiOperation);\n if (!this.selectedImage || !this.imageEditInfo || !this.wrapper || !this.clonedImage) {\n return;\n }\n\n operation(this.imageEditInfo);\n\n updateWrapper(\n this.imageEditInfo,\n this.options,\n this.selectedImage,\n this.clonedImage,\n this.wrapper\n );\n\n this.applyFormatWithContentModel(\n editor,\n false /* isCrop */,\n true /* shouldSelect*/,\n true /* isApiOperation */\n );\n }\n\n private cleanInfo() {\n this.editor?.setEditorStyle('imageEdit', null);\n this.selectedImage = null;\n this.shadowSpan = null;\n this.wrapper = null;\n this.imageEditInfo = null;\n this.imageHTMLOptions = null;\n this.dndHelpers.forEach(helper => helper.dispose());\n this.dndHelpers = [];\n this.clonedImage = null;\n this.lastSrc = null;\n this.wasImageResized = false;\n this.isCropMode = false;\n this.resizers = [];\n this.rotators = [];\n this.croppers = [];\n }\n\n private removeImageWrapper() {\n let image: HTMLImageElement | null = null;\n if (this.shadowSpan && this.shadowSpan.parentElement) {\n if (\n this.shadowSpan.firstElementChild &&\n isNodeOfType(this.shadowSpan.firstElementChild, 'ELEMENT_NODE') &&\n isElementOfType(this.shadowSpan.firstElementChild, 'img')\n ) {\n image = this.shadowSpan.firstElementChild;\n }\n unwrap(this.shadowSpan);\n this.shadowSpan = null;\n this.wrapper = null;\n }\n\n return image;\n }\n\n public flipImage(direction: 'horizontal' | 'vertical') {\n const selection = this.editor?.getDOMSelection();\n if (!this.editor || !selection || selection.type !== 'image') {\n return;\n }\n const image = selection.image;\n if (this.editor) {\n this.editImage(this.editor, image, ['flip'], imageEditInfo => {\n const angleRad = imageEditInfo.angleRad || 0;\n const isInVerticalPostion =\n (angleRad >= Math.PI / 2 && angleRad < (3 * Math.PI) / 4) ||\n (angleRad <= -Math.PI / 2 && angleRad > (-3 * Math.PI) / 4);\n if (isInVerticalPostion) {\n if (direction === 'horizontal') {\n imageEditInfo.flippedVertical = !imageEditInfo.flippedVertical;\n } else {\n imageEditInfo.flippedHorizontal = !imageEditInfo.flippedHorizontal;\n }\n } else {\n if (direction === 'vertical') {\n imageEditInfo.flippedVertical = !imageEditInfo.flippedVertical;\n } else {\n imageEditInfo.flippedHorizontal = !imageEditInfo.flippedHorizontal;\n }\n }\n });\n }\n }\n\n public rotateImage(angleRad: number) {\n const selection = this.editor?.getDOMSelection();\n if (!this.editor || !selection || selection.type !== 'image') {\n return;\n }\n const image = selection.image;\n if (this.editor) {\n this.editImage(this.editor, image, [], imageEditInfo => {\n imageEditInfo.angleRad = (imageEditInfo.angleRad || 0) + angleRad;\n });\n }\n }\n\n //EXPOSED FOR TEST ONLY\n public get isEditingImage() {\n return this.isEditing;\n }\n}\n"]}
|
|
@@ -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,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeImageSelection = void 0;
|
|
4
|
+
var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
|
|
5
|
+
/**
|
|
6
|
+
* Selecting directly on the image will only capture the image segment.
|
|
7
|
+
* However, if the selection is made while the image is within a wrapper, it will capture the span that encloses the image.
|
|
8
|
+
* In the last case, the selection will be marked as <---SelectionMarker---><---Image---><---SelectionMarker--->.
|
|
9
|
+
* To fix this behavior the extra selection markers are removed.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
function normalizeImageSelection(imageAndParagraph) {
|
|
13
|
+
var paragraph = imageAndParagraph.paragraph;
|
|
14
|
+
var index = paragraph.segments.indexOf(imageAndParagraph.image);
|
|
15
|
+
if (index > 0) {
|
|
16
|
+
var markerBefore = paragraph.segments[index - 1];
|
|
17
|
+
var markerAfter = paragraph.segments[index + 1];
|
|
18
|
+
if (markerBefore &&
|
|
19
|
+
markerAfter &&
|
|
20
|
+
markerAfter.segmentType == 'SelectionMarker' &&
|
|
21
|
+
markerBefore.segmentType == 'SelectionMarker' &&
|
|
22
|
+
markerAfter.isSelected &&
|
|
23
|
+
markerBefore.isSelected) {
|
|
24
|
+
var mutatedParagraph = (0, roosterjs_content_model_dom_1.mutateBlock)(paragraph);
|
|
25
|
+
mutatedParagraph.segments.splice(index - 1, 1);
|
|
26
|
+
mutatedParagraph.segments.splice(index, 1);
|
|
27
|
+
}
|
|
28
|
+
return imageAndParagraph;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.normalizeImageSelection = normalizeImageSelection;
|
|
32
|
+
//# 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,2EAA0D;AAG1D;;;;;;GAMG;AACH,SAAgB,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,IAAA,yCAAW,EAAC,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;AApBD,0DAoBC","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/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/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ImageEditPlugin = exports.CustomReplacePlugin = exports.PickerPlugin = exports.HyperlinkPlugin = exports.MarkdownPlugin = exports.WatermarkPlugin = exports.ContextMenuPluginBase = exports.ShortcutPlugin = exports.ShortcutOutdentList = exports.ShortcutIndentList = exports.ShortcutDecreaseFont = exports.ShortcutIncreaseFont = exports.ShortcutNumbering = exports.ShortcutBullet = exports.ShortcutRedoMacOS = exports.ShortcutRedoAlt = exports.ShortcutRedo = exports.ShortcutUndo2 = exports.ShortcutUndo = exports.ShortcutClearFormat = exports.ShortcutUnderline = exports.ShortcutItalic = exports.ShortcutBold = exports.AutoFormatPlugin = exports.EditPlugin = exports.PastePlugin = exports.TableEditPlugin = void 0;
|
|
3
|
+
exports.ImageEditPlugin = exports.CustomReplacePlugin = exports.PickerPlugin = exports.HyperlinkPlugin = exports.MarkdownPlugin = exports.WatermarkPlugin = exports.ContextMenuPluginBase = exports.ShortcutPlugin = exports.ShortcutOutdentList = exports.ShortcutIndentList = exports.ShortcutDecreaseFont = exports.ShortcutIncreaseFont = exports.ShortcutNumbering = exports.ShortcutBullet = exports.ShortcutRedoMacOS = exports.ShortcutRedoAlt = exports.ShortcutRedo = exports.ShortcutUndo2 = exports.ShortcutUndo = exports.ShortcutClearFormat = exports.ShortcutUnderline = exports.ShortcutItalic = exports.ShortcutBold = exports.AutoFormatPlugin = exports.EditPlugin = exports.DefaultSanitizers = exports.PastePlugin = exports.TableEditPlugin = void 0;
|
|
4
4
|
var TableEditPlugin_1 = require("./tableEdit/TableEditPlugin");
|
|
5
5
|
Object.defineProperty(exports, "TableEditPlugin", { enumerable: true, get: function () { return TableEditPlugin_1.TableEditPlugin; } });
|
|
6
6
|
var PastePlugin_1 = require("./paste/PastePlugin");
|
|
7
7
|
Object.defineProperty(exports, "PastePlugin", { enumerable: true, get: function () { return PastePlugin_1.PastePlugin; } });
|
|
8
|
+
var DefaultSanitizers_1 = require("./paste/DefaultSanitizers");
|
|
9
|
+
Object.defineProperty(exports, "DefaultSanitizers", { enumerable: true, get: function () { return DefaultSanitizers_1.DefaultSanitizers; } });
|
|
8
10
|
var EditPlugin_1 = require("./edit/EditPlugin");
|
|
9
11
|
Object.defineProperty(exports, "EditPlugin", { enumerable: true, get: function () { return EditPlugin_1.EditPlugin; } });
|
|
10
12
|
var AutoFormatPlugin_1 = require("./autoFormat/AutoFormatPlugin");
|
package/lib/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,+DAA8D;AAArD,kHAAA,eAAe,OAAA;AAGxB,mDAAkD;AAAzC,0GAAA,WAAW,OAAA;AACpB,gDAA4D;AAAnD,wGAAA,UAAU,OAAA;AACnB,kEAAoF;AAA3E,oHAAA,gBAAgB,OAAA;AAEzB,kDAgB8B;AAf1B,yGAAA,YAAY,OAAA;AACZ,2GAAA,cAAc,OAAA;AACd,8GAAA,iBAAiB,OAAA;AACjB,gHAAA,mBAAmB,OAAA;AACnB,yGAAA,YAAY,OAAA;AACZ,0GAAA,aAAa,OAAA;AACb,yGAAA,YAAY,OAAA;AACZ,4GAAA,eAAe,OAAA;AACf,8GAAA,iBAAiB,OAAA;AACjB,2GAAA,cAAc,OAAA;AACd,8GAAA,iBAAiB,OAAA;AACjB,iHAAA,oBAAoB,OAAA;AACpB,iHAAA,oBAAoB,OAAA;AACpB,+GAAA,kBAAkB,OAAA;AAClB,gHAAA,mBAAmB,OAAA;AAEvB,4DAA2D;AAAlD,gHAAA,cAAc,OAAA;AAEvB,iFAAoG;AAA3F,8HAAA,qBAAqB,OAAA;AAC9B,+DAA8D;AAArD,kHAAA,eAAe,OAAA;AAExB,4DAA4E;AAAnE,gHAAA,cAAc,OAAA;AACvB,+DAA8D;AAArD,kHAAA,eAAe,OAAA;AAExB,sDAAqD;AAA5C,4GAAA,YAAY,OAAA;AAGrB,2EAAyF;AAAhF,0HAAA,mBAAmB,OAAA;AAC5B,+DAA8D;AAArD,kHAAA,eAAe,OAAA","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,+DAA8D;AAArD,kHAAA,eAAe,OAAA;AAGxB,mDAAkD;AAAzC,0GAAA,WAAW,OAAA;AACpB,+DAA8D;AAArD,sHAAA,iBAAiB,OAAA;AAC1B,gDAA4D;AAAnD,wGAAA,UAAU,OAAA;AACnB,kEAAoF;AAA3E,oHAAA,gBAAgB,OAAA;AAEzB,kDAgB8B;AAf1B,yGAAA,YAAY,OAAA;AACZ,2GAAA,cAAc,OAAA;AACd,8GAAA,iBAAiB,OAAA;AACjB,gHAAA,mBAAmB,OAAA;AACnB,yGAAA,YAAY,OAAA;AACZ,0GAAA,aAAa,OAAA;AACb,yGAAA,YAAY,OAAA;AACZ,4GAAA,eAAe,OAAA;AACf,8GAAA,iBAAiB,OAAA;AACjB,2GAAA,cAAc,OAAA;AACd,8GAAA,iBAAiB,OAAA;AACjB,iHAAA,oBAAoB,OAAA;AACpB,iHAAA,oBAAoB,OAAA;AACpB,+GAAA,kBAAkB,OAAA;AAClB,gHAAA,mBAAmB,OAAA;AAEvB,4DAA2D;AAAlD,gHAAA,cAAc,OAAA;AAEvB,iFAAoG;AAA3F,8HAAA,qBAAqB,OAAA;AAC9B,+DAA8D;AAArD,kHAAA,eAAe,OAAA;AAExB,4DAA4E;AAAnE,gHAAA,cAAc,OAAA;AACvB,+DAA8D;AAArD,kHAAA,eAAe,OAAA;AAExB,sDAAqD;AAA5C,4GAAA,YAAY,OAAA;AAGrB,2EAAyF;AAAhF,0HAAA,mBAAmB,OAAA;AAC5B,+DAA8D;AAArD,kHAAA,eAAe,OAAA","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"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.divParagraphSanitizer = exports.DefaultSanitizers = void 0;
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Default style sanitizers for PastePlugin.
|
|
6
6
|
*/
|
|
7
7
|
exports.DefaultSanitizers = {
|
|
8
8
|
width: divParagraphSanitizer,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultSanitizers.js","sourceRoot":"","sources":["../../../../packages/roosterjs-content-model-plugins/lib/paste/DefaultSanitizers.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACU,QAAA,iBAAiB,GAAmC;IAC7D,KAAK,EAAE,qBAAqB;IAC5B,MAAM,EAAE,qBAAqB;IAC7B,aAAa,EAAE,qBAAqB;IACpC,YAAY,EAAE,qBAAqB;CACtC,CAAC;AAEF;;;GAGG;AACH,SAAgB,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;AAND,sDAMC","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;AACU,QAAA,iBAAiB,GAAmC;IAC7D,KAAK,EAAE,qBAAqB;IAC5B,MAAM,EAAE,qBAAqB;IAC7B,aAAa,EAAE,qBAAqB;IACpC,YAAY,EAAE,qBAAqB;CACtC,CAAC;AAEF;;;GAGG;AACH,SAAgB,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;AAND,sDAMC","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"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
define(["require", "exports", "./getListTypeStyle", "roosterjs-content-model-api"], function (require, exports, getListTypeStyle_1, roosterjs_content_model_api_1) {
|
|
1
|
+
define(["require", "exports", "tslib", "./getListTypeStyle", "roosterjs-content-model-dom", "roosterjs-content-model-api"], function (require, exports, tslib_1, getListTypeStyle_1, roosterjs_content_model_dom_1, roosterjs_content_model_api_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.keyboardListTrigger = void 0;
|
|
@@ -14,6 +14,7 @@ define(["require", "exports", "./getListTypeStyle", "roosterjs-content-model-api
|
|
|
14
14
|
var listType = listStyleType.listType, styleType = listStyleType.styleType, index = listStyleType.index;
|
|
15
15
|
triggerList(model, listType, styleType, index);
|
|
16
16
|
context.canUndoByBackspace = true;
|
|
17
|
+
setAnnounceData(model, context);
|
|
17
18
|
return true;
|
|
18
19
|
}
|
|
19
20
|
return false;
|
|
@@ -28,10 +29,20 @@ define(["require", "exports", "./getListTypeStyle", "roosterjs-content-model-api
|
|
|
28
29
|
(0, roosterjs_content_model_api_1.setModelListStyle)(model, isOrderedList
|
|
29
30
|
? {
|
|
30
31
|
orderedStyleType: styleType,
|
|
32
|
+
applyListStyleFromLevel: false,
|
|
31
33
|
}
|
|
32
34
|
: {
|
|
33
35
|
unorderedStyleType: styleType,
|
|
36
|
+
applyListStyleFromLevel: false,
|
|
34
37
|
});
|
|
35
38
|
};
|
|
39
|
+
function setAnnounceData(model, context) {
|
|
40
|
+
var _a = (0, tslib_1.__read)((0, roosterjs_content_model_dom_1.getOperationalBlocks)(model, ['ListItem'], [] // Set stop types to be empty so we can find list items even cross the boundary of table, then we can always operation on the list item if any
|
|
41
|
+
), 1), paragraphOrListItems = _a[0];
|
|
42
|
+
if (paragraphOrListItems && (0, roosterjs_content_model_dom_1.isBlockGroupOfType)(paragraphOrListItems.block, 'ListItem')) {
|
|
43
|
+
var path = paragraphOrListItems.path, block = paragraphOrListItems.block;
|
|
44
|
+
context.announceData = (0, roosterjs_content_model_api_1.getListAnnounceData)((0, tslib_1.__spreadArray)([block], (0, tslib_1.__read)(path), false));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
36
47
|
});
|
|
37
48
|
//# sourceMappingURL=keyboardListTrigger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboardListTrigger.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/autoFormat/list/keyboardListTrigger.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"keyboardListTrigger.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-plugins/lib/autoFormat/list/keyboardListTrigger.ts"],"names":[],"mappings":";;;;IAeA;;OAEG;IACH,SAAgB,mBAAmB,CAC/B,KAAmC,EACnC,SAA8C,EAC9C,OAAkC,EAClC,qBAAqC,EACrC,wBAAwC;QADxC,sCAAA,EAAA,4BAAqC;QACrC,yCAAA,EAAA,+BAAwC;QAExC,IAAM,aAAa,GAAG,IAAA,mCAAgB,EAAC,KAAK,EAAE,qBAAqB,EAAE,wBAAwB,CAAC,CAAC;QAC/F,IAAI,aAAa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CAAC,EAAE;YAC5E,IAAA,IAAI,GAAY,oBAAoB,KAAhC,EAAE,KAAK,GAAK,oBAAoB,MAAzB,CAA0B;YAC7C,OAAO,CAAC,YAAY,GAAG,IAAA,iDAAmB,8BAAE,KAAK,uBAAK,IAAI,UAAE,CAAC;SAChE;IACL,CAAC","sourcesContent":["import { getListTypeStyle } from './getListTypeStyle';\nimport { getOperationalBlocks, isBlockGroupOfType } from 'roosterjs-content-model-dom';\nimport {\n getListAnnounceData,\n setListType,\n setModelListStartNumber,\n setModelListStyle,\n} from 'roosterjs-content-model-api';\nimport type {\n ContentModelListItem,\n FormatContentModelContext,\n ReadonlyContentModelDocument,\n ShallowMutableContentModelParagraph,\n} from 'roosterjs-content-model-types';\n\n/**\n * @internal\n */\nexport function keyboardListTrigger(\n model: ReadonlyContentModelDocument,\n paragraph: ShallowMutableContentModelParagraph,\n context: FormatContentModelContext,\n shouldSearchForBullet: boolean = true,\n shouldSearchForNumbering: boolean = true\n) {\n const listStyleType = getListTypeStyle(model, shouldSearchForBullet, shouldSearchForNumbering);\n if (listStyleType) {\n paragraph.segments.splice(0, 1);\n const { listType, styleType, index } = listStyleType;\n triggerList(model, listType, styleType, index);\n context.canUndoByBackspace = true;\n setAnnounceData(model, context);\n\n return true;\n }\n return false;\n}\n\nconst triggerList = (\n model: ReadonlyContentModelDocument,\n listType: 'OL' | 'UL',\n styleType: number,\n index?: number\n) => {\n setListType(model, listType);\n const isOrderedList = listType == 'OL';\n if (index && index > 1 && isOrderedList) {\n setModelListStartNumber(model, index);\n }\n setModelListStyle(\n model,\n isOrderedList\n ? {\n orderedStyleType: styleType,\n applyListStyleFromLevel: false,\n }\n : {\n unorderedStyleType: styleType,\n applyListStyleFromLevel: false,\n }\n );\n};\nfunction setAnnounceData(model: ReadonlyContentModelDocument, context: FormatContentModelContext) {\n const [paragraphOrListItems] = getOperationalBlocks<ContentModelListItem>(\n model,\n ['ListItem'],\n [] // Set stop types to be empty so we can find list items even cross the boundary of table, then we can always operation on the list item if any\n );\n\n if (paragraphOrListItems && isBlockGroupOfType(paragraphOrListItems.block, 'ListItem')) {\n const { path, block } = paragraphOrListItems;\n context.announceData = getListAnnounceData([block, ...path]);\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
define(["require", "exports", "tslib", "./utils/applyChange", "./utils/canRegenerateImage", "./utils/imageEditUtils", "./utils/createImageWrapper", "./Cropper/cropperContext", "./utils/findEditingImage", "./utils/getDropAndDragHelpers", "./utils/getHTMLImageOptions", "./utils/getSelectedImage", "./utils/updateImageEditInfo", "./types/ImageEditElementClass", "./Resizer/resizerContext", "./Rotator/rotatorContext", "./Rotator/updateRotateHandle", "./utils/updateWrapper", "roosterjs-content-model-dom"], function (require, exports, tslib_1, applyChange_1, canRegenerateImage_1, imageEditUtils_1, createImageWrapper_1, cropperContext_1, findEditingImage_1, getDropAndDragHelpers_1, getHTMLImageOptions_1, getSelectedImage_1, updateImageEditInfo_1, ImageEditElementClass_1, resizerContext_1, rotatorContext_1, updateRotateHandle_1, updateWrapper_1, roosterjs_content_model_dom_1) {
|
|
1
|
+
define(["require", "exports", "tslib", "./utils/applyChange", "./utils/canRegenerateImage", "./utils/imageEditUtils", "./utils/createImageWrapper", "./Cropper/cropperContext", "./utils/findEditingImage", "./utils/getDropAndDragHelpers", "./utils/getHTMLImageOptions", "./utils/getSelectedImage", "./utils/updateImageEditInfo", "./types/ImageEditElementClass", "./utils/normalizeImageSelection", "./Resizer/resizerContext", "./Rotator/rotatorContext", "./Rotator/updateRotateHandle", "./utils/updateWrapper", "roosterjs-content-model-dom"], function (require, exports, tslib_1, applyChange_1, canRegenerateImage_1, imageEditUtils_1, createImageWrapper_1, cropperContext_1, findEditingImage_1, getDropAndDragHelpers_1, getHTMLImageOptions_1, getSelectedImage_1, updateImageEditInfo_1, ImageEditElementClass_1, normalizeImageSelection_1, resizerContext_1, rotatorContext_1, updateRotateHandle_1, updateWrapper_1, roosterjs_content_model_dom_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.ImageEditPlugin = void 0;
|
|
@@ -179,6 +179,9 @@ define(["require", "exports", "tslib", "./utils/applyChange", "./utils/canRegene
|
|
|
179
179
|
image.isSelected = shouldSelectImage;
|
|
180
180
|
image.isSelectedAsImageSelection = shouldSelectImage;
|
|
181
181
|
});
|
|
182
|
+
if (shouldSelectImage) {
|
|
183
|
+
(0, normalizeImageSelection_1.normalizeImageSelection)(previousSelectedImage);
|
|
184
|
+
}
|
|
182
185
|
_this.cleanInfo();
|
|
183
186
|
result = true;
|
|
184
187
|
}
|