@syncfusion/ej2-richtexteditor 21.2.9 → 22.1.34
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/.eslintrc.json +1 -0
- package/CHANGELOG.md +30 -0
- package/dist/ej2-richtexteditor.min.js +2 -2
- package/dist/ej2-richtexteditor.umd.min.js +2 -2
- package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es2015.js +1592 -196
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +1605 -199
- package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
- package/dist/global/ej2-richtexteditor.min.js +2 -2
- package/dist/global/ej2-richtexteditor.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +12 -12
- package/src/common/config.js +2 -2
- package/src/common/constant.d.ts +6 -0
- package/src/common/constant.js +6 -0
- package/src/common/interface.d.ts +2 -2
- package/src/common/util.js +2 -0
- package/src/editor-manager/base/editor-manager.d.ts +4 -3
- package/src/editor-manager/base/editor-manager.js +6 -1
- package/src/editor-manager/base/interface.d.ts +44 -9
- package/src/editor-manager/plugin/clearformat.d.ts +1 -0
- package/src/editor-manager/plugin/clearformat.js +1 -0
- package/src/editor-manager/plugin/dom-node.js +10 -6
- package/src/editor-manager/plugin/emoji-picker-action.d.ts +8 -0
- package/src/editor-manager/plugin/emoji-picker-action.js +62 -0
- package/src/editor-manager/plugin/format-painter-actions.d.ts +19 -36
- package/src/editor-manager/plugin/format-painter-actions.js +224 -81
- package/src/editor-manager/plugin/inserthtml.js +6 -1
- package/src/editor-manager/plugin/link.js +1 -1
- package/src/editor-manager/plugin/ms-word-clean-up.d.ts +3 -0
- package/src/editor-manager/plugin/ms-word-clean-up.js +66 -14
- package/src/editor-manager/plugin/selection-commands.d.ts +2 -1
- package/src/editor-manager/plugin/selection-commands.js +48 -23
- package/src/editor-manager/plugin/table.js +2 -2
- package/src/editor-manager/plugin/toolbar-status.js +6 -0
- package/src/editor-manager/plugin/undo.d.ts +1 -0
- package/src/editor-manager/plugin/undo.js +26 -5
- package/src/editor-manager/plugin.d.ts +1 -0
- package/src/editor-manager/plugin.js +1 -0
- package/src/global.js +1 -1
- package/src/rich-text-editor/actions/base-quick-toolbar.js +10 -3
- package/src/rich-text-editor/actions/base-toolbar.js +3 -2
- package/src/rich-text-editor/actions/emoji-picker.d.ts +48 -0
- package/src/rich-text-editor/actions/emoji-picker.js +778 -0
- package/src/rich-text-editor/actions/enter-key.js +2 -2
- package/src/rich-text-editor/actions/execute-command-callback.js +3 -1
- package/src/rich-text-editor/actions/file-manager.js +1 -0
- package/src/rich-text-editor/actions/format-painter.d.ts +2 -2
- package/src/rich-text-editor/actions/format-painter.js +11 -9
- package/src/rich-text-editor/actions/full-screen.js +6 -0
- package/src/rich-text-editor/actions/html-editor.js +17 -3
- package/src/rich-text-editor/actions/paste-clean-up.js +1 -0
- package/src/rich-text-editor/actions/resize.js +1 -1
- package/src/rich-text-editor/actions.d.ts +1 -0
- package/src/rich-text-editor/actions.js +1 -0
- package/src/rich-text-editor/base/constant.d.ts +10 -0
- package/src/rich-text-editor/base/constant.js +10 -0
- package/src/rich-text-editor/base/enum.d.ts +0 -4
- package/src/rich-text-editor/base/interface.d.ts +48 -6
- package/src/rich-text-editor/base/rich-text-editor-model.d.ts +13 -7
- package/src/rich-text-editor/base/rich-text-editor.d.ts +27 -7
- package/src/rich-text-editor/base/rich-text-editor.js +42 -12
- package/src/rich-text-editor/base/util.js +2 -2
- package/src/rich-text-editor/formatter/formatter.js +7 -5
- package/src/rich-text-editor/models/default-locale.js +14 -2
- package/src/rich-text-editor/models/items.d.ts +2 -1
- package/src/rich-text-editor/models/items.js +188 -1
- package/src/rich-text-editor/models/toolbar-settings-model.d.ts +212 -9
- package/src/rich-text-editor/models/toolbar-settings.d.ts +209 -11
- package/src/rich-text-editor/models/toolbar-settings.js +23 -6
- package/src/rich-text-editor/renderer/audio-module.js +3 -3
- package/src/rich-text-editor/renderer/iframe-content-renderer.js +1 -1
- package/src/rich-text-editor/renderer/image-module.js +11 -6
- package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +2 -0
- package/src/rich-text-editor/renderer/toolbar-renderer.js +7 -2
- package/src/rich-text-editor/renderer/video-module.js +14 -9
- package/styles/bootstrap-dark.css +299 -137
- package/styles/bootstrap.css +305 -140
- package/styles/bootstrap4.css +304 -133
- package/styles/bootstrap5-dark.css +310 -165
- package/styles/bootstrap5.css +310 -165
- package/styles/fabric-dark.css +297 -136
- package/styles/fabric.css +294 -133
- package/styles/fluent-dark.css +311 -170
- package/styles/fluent.css +311 -170
- package/styles/highcontrast-light.css +289 -128
- package/styles/highcontrast.css +296 -135
- package/styles/material-dark.css +295 -129
- package/styles/material.css +300 -134
- package/styles/material3-dark.css +3082 -0
- package/styles/material3-dark.scss +3 -0
- package/styles/material3.css +3138 -0
- package/styles/material3.scss +3 -0
- package/styles/rich-text-editor/_bootstrap-dark-definition.scss +54 -12
- package/styles/rich-text-editor/_bootstrap-definition.scss +57 -13
- package/styles/rich-text-editor/_bootstrap4-definition.scss +50 -7
- package/styles/rich-text-editor/_bootstrap5-definition.scss +56 -13
- package/styles/rich-text-editor/_fabric-dark-definition.scss +53 -10
- package/styles/rich-text-editor/_fabric-definition.scss +52 -9
- package/styles/rich-text-editor/_fluent-definition.scss +56 -15
- package/styles/rich-text-editor/_fusionnew-definition.scss +46 -4
- package/styles/rich-text-editor/_highcontrast-definition.scss +52 -9
- package/styles/rich-text-editor/_highcontrast-light-definition.scss +48 -5
- package/styles/rich-text-editor/_layout.scss +280 -68
- package/styles/rich-text-editor/_material-dark-definition.scss +48 -5
- package/styles/rich-text-editor/_material-definition.scss +50 -6
- package/styles/rich-text-editor/_material3-dark-definition.scss +1 -0
- package/styles/rich-text-editor/_material3-definition.scss +262 -0
- package/styles/rich-text-editor/_tailwind-definition.scss +63 -23
- package/styles/rich-text-editor/_theme.scss +103 -19
- package/styles/rich-text-editor/bootstrap-dark.css +299 -137
- package/styles/rich-text-editor/bootstrap.css +305 -140
- package/styles/rich-text-editor/bootstrap4.css +304 -133
- package/styles/rich-text-editor/bootstrap5-dark.css +310 -165
- package/styles/rich-text-editor/bootstrap5.css +310 -165
- package/styles/rich-text-editor/fabric-dark.css +297 -136
- package/styles/rich-text-editor/fabric.css +294 -133
- package/styles/rich-text-editor/fluent-dark.css +311 -170
- package/styles/rich-text-editor/fluent.css +311 -170
- package/styles/rich-text-editor/highcontrast-light.css +289 -128
- package/styles/rich-text-editor/highcontrast.css +296 -135
- package/styles/rich-text-editor/icons/_bootstrap-dark.scss +1 -1
- package/styles/rich-text-editor/icons/_bootstrap.scss +1 -1
- package/styles/rich-text-editor/icons/_bootstrap4.scss +1 -1
- package/styles/rich-text-editor/icons/_bootstrap5.scss +1 -1
- package/styles/rich-text-editor/icons/_fabric-dark.scss +1 -1
- package/styles/rich-text-editor/icons/_fabric.scss +1 -1
- package/styles/rich-text-editor/icons/_fluent.scss +1 -1
- package/styles/rich-text-editor/icons/_fusionnew.scss +1 -1
- package/styles/rich-text-editor/icons/_highcontrast-light.scss +1 -1
- package/styles/rich-text-editor/icons/_highcontrast.scss +1 -1
- package/styles/rich-text-editor/icons/_material-dark.scss +1 -1
- package/styles/rich-text-editor/icons/_material.scss +1 -1
- package/styles/rich-text-editor/icons/_material3-dark.scss +1 -0
- package/styles/rich-text-editor/icons/_material3.scss +1 -1
- package/styles/rich-text-editor/icons/_tailwind.scss +1 -1
- package/styles/rich-text-editor/material-dark.css +295 -129
- package/styles/rich-text-editor/material.css +300 -134
- package/styles/rich-text-editor/material3-dark.css +3082 -0
- package/styles/rich-text-editor/material3-dark.scss +5 -0
- package/styles/rich-text-editor/material3.css +3138 -0
- package/styles/rich-text-editor/material3.scss +5 -0
- package/styles/rich-text-editor/tailwind-dark.css +313 -157
- package/styles/rich-text-editor/tailwind.css +313 -157
- package/styles/tailwind-dark.css +313 -157
- package/styles/tailwind.css +313 -157
package/dist/global/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: index.d.ts
|
|
3
|
-
* version :
|
|
3
|
+
* version : 22.1.34
|
|
4
4
|
* Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
|
|
5
5
|
* Use of this code is subject to the terms of our license.
|
|
6
6
|
* A copy of the current license can be obtained at any time by e-mailing
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_from": "@syncfusion/ej2-richtexteditor@*",
|
|
3
|
-
"_id": "@syncfusion/ej2-richtexteditor@21.
|
|
3
|
+
"_id": "@syncfusion/ej2-richtexteditor@21.8.0",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "sha512-
|
|
5
|
+
"_integrity": "sha512-KKugUmllHAC97zgvz2Bo3y8SB95H4fuecSj40S5i6oXXbNLdkOsYoPr66a38Di+/igSY9RgzG7R9BedERFsMQg==",
|
|
6
6
|
"_location": "/@syncfusion/ej2-richtexteditor",
|
|
7
7
|
"_phantomChildren": {},
|
|
8
8
|
"_requested": {
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"/@syncfusion/ej2-react-richtexteditor",
|
|
27
27
|
"/@syncfusion/ej2-vue-richtexteditor"
|
|
28
28
|
],
|
|
29
|
-
"_resolved": "https://nexus.syncfusion.com/repository/ej2-
|
|
30
|
-
"_shasum": "
|
|
29
|
+
"_resolved": "https://nexus.syncfusion.com/repository/ej2-release/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-21.8.0.tgz",
|
|
30
|
+
"_shasum": "11fb16ec178e4100183ec60405ad3ed21c7b38e9",
|
|
31
31
|
"_spec": "@syncfusion/ej2-richtexteditor@*",
|
|
32
32
|
"_where": "/jenkins/workspace/elease-automation_release_21.1.1/packages/included",
|
|
33
33
|
"author": {
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
},
|
|
39
39
|
"bundleDependencies": false,
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@syncfusion/ej2-base": "~
|
|
42
|
-
"@syncfusion/ej2-buttons": "~
|
|
43
|
-
"@syncfusion/ej2-filemanager": "~
|
|
44
|
-
"@syncfusion/ej2-inputs": "~
|
|
45
|
-
"@syncfusion/ej2-navigations": "~
|
|
46
|
-
"@syncfusion/ej2-popups": "~
|
|
47
|
-
"@syncfusion/ej2-splitbuttons": "~
|
|
41
|
+
"@syncfusion/ej2-base": "~22.1.34",
|
|
42
|
+
"@syncfusion/ej2-buttons": "~22.1.34",
|
|
43
|
+
"@syncfusion/ej2-filemanager": "~22.1.34",
|
|
44
|
+
"@syncfusion/ej2-inputs": "~22.1.34",
|
|
45
|
+
"@syncfusion/ej2-navigations": "~22.1.34",
|
|
46
|
+
"@syncfusion/ej2-popups": "~22.1.34",
|
|
47
|
+
"@syncfusion/ej2-splitbuttons": "~22.1.34"
|
|
48
48
|
},
|
|
49
49
|
"deprecated": false,
|
|
50
50
|
"description": "Essential JS 2 RichTextEditor component",
|
|
@@ -70,6 +70,6 @@
|
|
|
70
70
|
"url": "git+https://github.com/syncfusion/ej2-javascript-ui-controls.git"
|
|
71
71
|
},
|
|
72
72
|
"typings": "index.d.ts",
|
|
73
|
-
"version": "
|
|
73
|
+
"version": "22.1.34",
|
|
74
74
|
"sideEffects": false
|
|
75
75
|
}
|
package/src/common/config.js
CHANGED
|
@@ -73,8 +73,8 @@ export var htmlKeyConfig = {
|
|
|
73
73
|
'enter': '13',
|
|
74
74
|
'tab': 'tab',
|
|
75
75
|
'delete': '46',
|
|
76
|
-
'format-copy': '
|
|
77
|
-
'format-paste': '
|
|
76
|
+
'format-copy': 'alt+shift+c',
|
|
77
|
+
'format-paste': 'alt+shift+v'
|
|
78
78
|
};
|
|
79
79
|
/**
|
|
80
80
|
* Default markdown key config for adapter
|
package/src/common/constant.d.ts
CHANGED
package/src/common/constant.js
CHANGED
package/src/common/util.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Observer } from '@syncfusion/ej2-base';
|
|
2
|
-
import { ICommandModel } from './interface';
|
|
2
|
+
import { ICommandModel, IFormatPainterEditor } from './interface';
|
|
3
3
|
import { EditorExecCommand as ExecCommand } from './types';
|
|
4
4
|
import { Lists } from './../plugin/lists';
|
|
5
5
|
import { NodeSelection } from './../../selection/index';
|
|
@@ -19,7 +19,7 @@ import { UndoRedoManager } from './../plugin/undo';
|
|
|
19
19
|
import { MsWordPaste } from '../plugin/ms-word-clean-up';
|
|
20
20
|
import { InsertTextExec } from '../plugin/insert-text';
|
|
21
21
|
import { NodeCutter } from '../plugin/nodecutter';
|
|
22
|
-
import {
|
|
22
|
+
import { EmojiPickerAction } from '../plugin/emoji-picker-action';
|
|
23
23
|
/**
|
|
24
24
|
* EditorManager internal component
|
|
25
25
|
*
|
|
@@ -47,8 +47,9 @@ export declare class EditorManager {
|
|
|
47
47
|
clearObj: ClearFormatExec;
|
|
48
48
|
undoRedoManager: UndoRedoManager;
|
|
49
49
|
msWordPaste: MsWordPaste;
|
|
50
|
-
|
|
50
|
+
formatPainterEditor: IFormatPainterEditor;
|
|
51
51
|
editableElement: Element;
|
|
52
|
+
emojiPickerObj: EmojiPickerAction;
|
|
52
53
|
/**
|
|
53
54
|
* Constructor for creating the component
|
|
54
55
|
*
|
|
@@ -20,6 +20,7 @@ import * as EVENTS from './../../common/constant';
|
|
|
20
20
|
import { InsertTextExec } from '../plugin/insert-text';
|
|
21
21
|
import { NodeCutter } from '../plugin/nodecutter';
|
|
22
22
|
import { FormatPainterActions } from '../plugin/format-painter-actions';
|
|
23
|
+
import { EmojiPickerAction } from '../plugin/emoji-picker-action';
|
|
23
24
|
/**
|
|
24
25
|
* EditorManager internal component
|
|
25
26
|
*
|
|
@@ -56,7 +57,8 @@ var EditorManager = /** @class */ (function () {
|
|
|
56
57
|
this.tableObj = new TableCommand(this);
|
|
57
58
|
this.undoRedoManager = new UndoRedoManager(this, options.options);
|
|
58
59
|
this.msWordPaste = new MsWordPaste(this);
|
|
59
|
-
this.
|
|
60
|
+
this.formatPainterEditor = new FormatPainterActions(this, options.formatPainterSettings);
|
|
61
|
+
this.emojiPickerObj = new EmojiPickerAction(this);
|
|
60
62
|
this.wireEvents();
|
|
61
63
|
}
|
|
62
64
|
EditorManager.prototype.wireEvents = function () {
|
|
@@ -204,6 +206,9 @@ var EditorManager = /** @class */ (function () {
|
|
|
204
206
|
case 'formatpainter':
|
|
205
207
|
this.observer.notify(EVENTS.FORMAT_PAINTER_ACTIONS, { item: exeValue, subCommand: value, event: event, callBack: callBack });
|
|
206
208
|
break;
|
|
209
|
+
case 'emojipicker':
|
|
210
|
+
this.observer.notify(EVENTS.EMOJI_PICKER_ACTIONS, { item: exeValue, subCommand: value, value: text,
|
|
211
|
+
event: event, callBack: callBack });
|
|
207
212
|
}
|
|
208
213
|
};
|
|
209
214
|
return EditorManager;
|
|
@@ -123,12 +123,13 @@ export interface IHtmlItemArgs {
|
|
|
123
123
|
insertElement?: Element;
|
|
124
124
|
captionClass?: string;
|
|
125
125
|
action?: string;
|
|
126
|
+
formatPainterAction?: IFormatPainterActionValue;
|
|
126
127
|
}
|
|
127
128
|
/**
|
|
128
129
|
|
|
129
130
|
*/
|
|
130
131
|
export interface IHtmlUndoRedoData {
|
|
131
|
-
text?:
|
|
132
|
+
text?: DocumentFragment;
|
|
132
133
|
range?: NodeSelection;
|
|
133
134
|
}
|
|
134
135
|
/**
|
|
@@ -176,18 +177,52 @@ export interface IFormatPainterSettings {
|
|
|
176
177
|
* @hidden
|
|
177
178
|
*
|
|
178
179
|
*/
|
|
179
|
-
export interface
|
|
180
|
-
|
|
181
|
-
event: MouseEvent | KeyboardEvent;
|
|
182
|
-
item: IFormatPainterAction;
|
|
183
|
-
subCommand: string;
|
|
180
|
+
export interface IFormatPainterAction {
|
|
181
|
+
formatPainterAction: IFormatPainterActionValue;
|
|
184
182
|
}
|
|
185
183
|
/**
|
|
184
|
+
* @private
|
|
185
|
+
* @hidden
|
|
186
186
|
*
|
|
187
|
-
|
|
187
|
+
*/
|
|
188
|
+
export interface IFormatPainterEditor {
|
|
189
|
+
destroy: Function;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* @private
|
|
193
|
+
* @hidden
|
|
194
|
+
*/
|
|
195
|
+
export interface FormatPainterCollection {
|
|
196
|
+
attrs: Attr[];
|
|
197
|
+
className: string;
|
|
198
|
+
styles: CSSPropCollection[];
|
|
199
|
+
tagName: string;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* @private
|
|
188
203
|
* @hidden
|
|
189
204
|
*
|
|
190
205
|
*/
|
|
191
|
-
export interface
|
|
192
|
-
|
|
206
|
+
export interface FormatPainterValue {
|
|
207
|
+
element: HTMLElement;
|
|
208
|
+
lastChild: HTMLElement;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* @private
|
|
212
|
+
* @hidden
|
|
213
|
+
*/
|
|
214
|
+
export interface DeniedFormatsCollection {
|
|
215
|
+
tag: string;
|
|
216
|
+
styles: string[];
|
|
217
|
+
attributes: string[];
|
|
218
|
+
classes: string[];
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* @private
|
|
222
|
+
* @hidden
|
|
223
|
+
*/
|
|
224
|
+
export interface CSSPropCollection {
|
|
225
|
+
property: string;
|
|
226
|
+
value: string;
|
|
227
|
+
priority: string;
|
|
193
228
|
}
|
|
@@ -12,6 +12,7 @@ export declare class ClearFormat {
|
|
|
12
12
|
* @param {Node} endNode - specifies the end node
|
|
13
13
|
* @param {string} enterAction - specifies the enter key action
|
|
14
14
|
* @param {string} selector - specifies the string value
|
|
15
|
+
* @param {string} command - specifies the command value
|
|
15
16
|
* @returns {void}
|
|
16
17
|
* @hidden
|
|
17
18
|
|
|
@@ -18,6 +18,7 @@ var ClearFormat = /** @class */ (function () {
|
|
|
18
18
|
* @param {Node} endNode - specifies the end node
|
|
19
19
|
* @param {string} enterAction - specifies the enter key action
|
|
20
20
|
* @param {string} selector - specifies the string value
|
|
21
|
+
* @param {string} command - specifies the command value
|
|
21
22
|
* @returns {void}
|
|
22
23
|
* @hidden
|
|
23
24
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as CONSTANT from './../base/constant';
|
|
2
|
-
import { append, detach, createElement, isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
2
|
+
import { append, detach, createElement, isNullOrUndefined as isNOU } from '@syncfusion/ej2-base';
|
|
3
3
|
import { NodeSelection } from './../../selection/index';
|
|
4
4
|
import { selfClosingTags } from '../../common/config';
|
|
5
5
|
import { getLastTextNode } from '../../common/util';
|
|
@@ -451,8 +451,12 @@ var DOMNode = /** @class */ (function () {
|
|
|
451
451
|
var end = this.parent.querySelector('.' + markerClassName.endSelection);
|
|
452
452
|
var startTextNode;
|
|
453
453
|
var endTextNode;
|
|
454
|
-
if (start.textContent === '' &&
|
|
455
|
-
if (
|
|
454
|
+
if (start.textContent === '' && isNOU(end) && action !== 'tab') {
|
|
455
|
+
if (isNOU(action) && save.range.startContainer.nodeType === 1 &&
|
|
456
|
+
save.range.startContainer.querySelectorAll('audio,video,image').length === 0) {
|
|
457
|
+
start.innerHTML = '<br>';
|
|
458
|
+
}
|
|
459
|
+
else if (start.childNodes.length === 1 && start.childNodes[0].nodeName === 'BR') {
|
|
456
460
|
start.innerHTML = '<br>';
|
|
457
461
|
}
|
|
458
462
|
else {
|
|
@@ -541,7 +545,7 @@ var DOMNode = /** @class */ (function () {
|
|
|
541
545
|
markerStart.appendChild(start);
|
|
542
546
|
}
|
|
543
547
|
else {
|
|
544
|
-
if (start.nodeType !== 3 && start.nodeName !== '#text') {
|
|
548
|
+
if (start.nodeType !== 3 && start.nodeName !== '#text' && start.nodeName !== 'BR') {
|
|
545
549
|
var marker = this.marker(markerClassName.startSelection, '');
|
|
546
550
|
append([this.parseHTMLFragment(marker)], start);
|
|
547
551
|
}
|
|
@@ -595,7 +599,7 @@ var DOMNode = /** @class */ (function () {
|
|
|
595
599
|
if (start.textContent === '') {
|
|
596
600
|
var tdNode = start.querySelectorAll('td');
|
|
597
601
|
start = tdNode[tdNode.length - 1];
|
|
598
|
-
start = !
|
|
602
|
+
start = !isNOU(start.childNodes[0]) ? start.childNodes[0] : start;
|
|
599
603
|
}
|
|
600
604
|
else {
|
|
601
605
|
var lastNode = start.lastChild;
|
|
@@ -755,7 +759,7 @@ var DOMNode = /** @class */ (function () {
|
|
|
755
759
|
}
|
|
756
760
|
parentNode = this.blockParentNode(endNode);
|
|
757
761
|
if (parentNode && this.ignoreTableTag(parentNode) && collectionNodes.indexOf(parentNode) < 0 &&
|
|
758
|
-
(!
|
|
762
|
+
(!isNOU(parentNode.previousElementSibling) && parentNode.previousElementSibling.tagName !== 'IMG')) {
|
|
759
763
|
collectionNodes.push(parentNode);
|
|
760
764
|
}
|
|
761
765
|
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as EVENTS from './../../common/constant';
|
|
2
|
+
import { InsertHtml } from './inserthtml';
|
|
3
|
+
var EmojiPickerAction = /** @class */ (function () {
|
|
4
|
+
function EmojiPickerAction(parent) {
|
|
5
|
+
this.parent = parent;
|
|
6
|
+
this.addEventListener();
|
|
7
|
+
}
|
|
8
|
+
EmojiPickerAction.prototype.addEventListener = function () {
|
|
9
|
+
this.parent.observer.on(EVENTS.EMOJI_PICKER_ACTIONS, this.emojiInsert, this);
|
|
10
|
+
};
|
|
11
|
+
EmojiPickerAction.prototype.emojiInsert = function (args) {
|
|
12
|
+
var node = document.createTextNode(args.value);
|
|
13
|
+
var selection = window.getSelection();
|
|
14
|
+
var range = selection.getRangeAt(0);
|
|
15
|
+
var cursorPos = range.startOffset;
|
|
16
|
+
for (var i = cursorPos - 1; i >= cursorPos - 15; i--) {
|
|
17
|
+
var prevChar_1 = selection.focusNode.textContent.substring(i - 1, i);
|
|
18
|
+
var isPrevSpace_1 = /:$/.test(prevChar_1);
|
|
19
|
+
if (isPrevSpace_1) {
|
|
20
|
+
this.beforeApplyFormat(true);
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
var colon = /:$/.test(selection.focusNode.textContent.charAt(cursorPos - 1));
|
|
25
|
+
var prevChar = selection.focusNode.textContent.charAt(cursorPos - 2);
|
|
26
|
+
var isPrevSpace = /\s/.test(prevChar);
|
|
27
|
+
if (colon && (isPrevSpace || selection.focusOffset === 1)) {
|
|
28
|
+
this.beforeApplyFormat(true);
|
|
29
|
+
}
|
|
30
|
+
InsertHtml.Insert(this.parent.currentDocument, node, this.parent.editableElement);
|
|
31
|
+
if (args.callBack) {
|
|
32
|
+
args.callBack({
|
|
33
|
+
requestType: args.subCommand,
|
|
34
|
+
editorMode: 'HTML',
|
|
35
|
+
event: args.event,
|
|
36
|
+
range: this.parent.nodeSelection.getRange(this.parent.currentDocument),
|
|
37
|
+
elements: this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument)
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
EmojiPickerAction.prototype.beforeApplyFormat = function (isBlockFormat) {
|
|
42
|
+
var range1 = this.parent.nodeSelection.getRange(this.parent.currentDocument);
|
|
43
|
+
var node = this.parent.nodeSelection.getNodeCollection(range1)[0];
|
|
44
|
+
var blockNewLine = !(node.parentElement.innerHTML.replace(/ |<br>/g, '').trim() === ':' || node.textContent.trim().indexOf('/') === 0);
|
|
45
|
+
var startNode = node;
|
|
46
|
+
if (blockNewLine && isBlockFormat) {
|
|
47
|
+
while (startNode !== this.parent.editableElement) {
|
|
48
|
+
startNode = startNode.parentElement;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
var startPoint = range1.startOffset;
|
|
52
|
+
while (this.parent.nodeSelection.getRange(document).toString().indexOf(':') === -1) {
|
|
53
|
+
this.parent.nodeSelection.setSelectionText(document, node, node, startPoint, range1.endOffset);
|
|
54
|
+
startPoint--;
|
|
55
|
+
}
|
|
56
|
+
var range2 = this.parent.nodeSelection.getRange(this.parent.currentDocument);
|
|
57
|
+
var node2 = this.parent.nodeCutter.GetSpliceNode(range2, node);
|
|
58
|
+
node2.parentNode.removeChild(node2);
|
|
59
|
+
};
|
|
60
|
+
return EmojiPickerAction;
|
|
61
|
+
}());
|
|
62
|
+
export { EmojiPickerAction };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { IFormatPainterSettings } from '../base';
|
|
1
|
+
import { IFormatPainterEditor, IFormatPainterSettings } from '../base';
|
|
2
2
|
import { EditorManager } from '../base';
|
|
3
|
-
export declare class FormatPainterActions {
|
|
3
|
+
export declare class FormatPainterActions implements IFormatPainterEditor {
|
|
4
|
+
private INVALID_TAGS;
|
|
4
5
|
private parent;
|
|
5
6
|
private copyCollection;
|
|
6
7
|
private deniedFormatsCollection;
|
|
@@ -9,7 +10,19 @@ export declare class FormatPainterActions {
|
|
|
9
10
|
private settings;
|
|
10
11
|
constructor(parent?: EditorManager, options?: IFormatPainterSettings);
|
|
11
12
|
private addEventListener;
|
|
13
|
+
private onPropertyChanged;
|
|
14
|
+
private removeEventListener;
|
|
15
|
+
/**
|
|
16
|
+
* Destroys the format painter.
|
|
17
|
+
*
|
|
18
|
+
* @function destroy
|
|
19
|
+
* @returns {void}
|
|
20
|
+
* @hidden
|
|
21
|
+
|
|
22
|
+
*/
|
|
23
|
+
destroy(): void;
|
|
12
24
|
private actionHandler;
|
|
25
|
+
private callBack;
|
|
13
26
|
private generateElement;
|
|
14
27
|
private pasteAction;
|
|
15
28
|
private removeDeniedFormats;
|
|
@@ -23,41 +36,11 @@ export declare class FormatPainterActions {
|
|
|
23
36
|
private findCurrentContext;
|
|
24
37
|
private insertFormatNode;
|
|
25
38
|
private insertBlockNode;
|
|
39
|
+
private insertNewList;
|
|
40
|
+
private insertSameList;
|
|
41
|
+
private isSameListType;
|
|
26
42
|
private cleanEmptyLists;
|
|
27
43
|
private setDeniedFormats;
|
|
44
|
+
private detachEmptyBlockNodes;
|
|
28
45
|
private makeDeniedFormatsCollection;
|
|
29
46
|
}
|
|
30
|
-
/**
|
|
31
|
-
* @hidden
|
|
32
|
-
*/
|
|
33
|
-
export interface FormatPainterCollection {
|
|
34
|
-
attrs: Attr[];
|
|
35
|
-
className: string;
|
|
36
|
-
styles: CSSPropCollection[];
|
|
37
|
-
tagName: string;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* @hidden
|
|
41
|
-
*
|
|
42
|
-
*/
|
|
43
|
-
export interface FormatPainterValue {
|
|
44
|
-
element: HTMLElement;
|
|
45
|
-
lastChild: HTMLElement;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* @hidden
|
|
49
|
-
*/
|
|
50
|
-
export interface DeniedFormatsCollection {
|
|
51
|
-
tag: string;
|
|
52
|
-
styles: string[];
|
|
53
|
-
attributes: string[];
|
|
54
|
-
classes: string[];
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* @hidden
|
|
58
|
-
*/
|
|
59
|
-
export interface CSSPropCollection {
|
|
60
|
-
property: string;
|
|
61
|
-
value: string;
|
|
62
|
-
priority: string;
|
|
63
|
-
}
|