@skyux/text-editor 5.6.0 → 5.7.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/bundles/skyux-text-editor.umd.js +5 -4
- package/documentation.json +2 -46
- package/esm2015/lib/modules/shared/sky-text-editor-resources.module.js +1 -1
- package/esm2015/lib/modules/shared/sky-text-editor-resources.module.js.map +1 -1
- package/esm2015/lib/modules/text-editor/services/text-editor-adapter.service.js +2 -1
- package/esm2015/lib/modules/text-editor/services/text-editor-adapter.service.js.map +1 -1
- package/esm2015/lib/modules/text-editor/text-editor.component.js +2 -2
- package/esm2015/lib/modules/text-editor/text-editor.component.js.map +1 -1
- package/fesm2015/skyux-text-editor.js +5 -4
- package/fesm2015/skyux-text-editor.js.map +1 -1
- package/lib/modules/shared/sky-text-editor-resources.module.d.ts +1 -1
- package/package.json +22 -19
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
/**
|
|
135
135
|
* NOTICE: DO NOT MODIFY THIS FILE!
|
|
136
136
|
* The contents of this file were automatically generated by
|
|
137
|
-
* the 'ng generate @skyux/i18n:lib-resources-module modules/shared/sky-text-editor' schematic.
|
|
137
|
+
* the 'ng generate @skyux/i18n:lib-resources-module lib/modules/shared/sky-text-editor' schematic.
|
|
138
138
|
* To update this file, simply rerun the command.
|
|
139
139
|
*/
|
|
140
140
|
var RESOURCES = {
|
|
@@ -1177,7 +1177,8 @@
|
|
|
1177
1177
|
range.deleteContents();
|
|
1178
1178
|
var el = documentEl.createElement('div');
|
|
1179
1179
|
el.innerHTML = html;
|
|
1180
|
-
var frag = documentEl.createDocumentFragment()
|
|
1180
|
+
var frag = documentEl.createDocumentFragment();
|
|
1181
|
+
var node = void 0, lastNode = void 0;
|
|
1181
1182
|
while (el.firstChild) {
|
|
1182
1183
|
node = el.firstChild;
|
|
1183
1184
|
lastNode = frag.appendChild(node);
|
|
@@ -1833,9 +1834,9 @@
|
|
|
1833
1834
|
this._initialStyleState = Object.assign({}, STYLE_STATE_DEFAULTS);
|
|
1834
1835
|
this._placeholder = '';
|
|
1835
1836
|
this._value = '<p></p>';
|
|
1836
|
-
|
|
1837
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1837
1838
|
this._onTouched = function () { };
|
|
1838
|
-
|
|
1839
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1839
1840
|
this._onChange = function () { };
|
|
1840
1841
|
this.ngControl.valueAccessor = this;
|
|
1841
1842
|
}
|
package/documentation.json
CHANGED
|
@@ -38,29 +38,7 @@
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
],
|
|
41
|
-
"children": [
|
|
42
|
-
{
|
|
43
|
-
"id": 226,
|
|
44
|
-
"name": "constructor",
|
|
45
|
-
"kind": 512,
|
|
46
|
-
"kindString": "Constructor",
|
|
47
|
-
"flags": {},
|
|
48
|
-
"signatures": [
|
|
49
|
-
{
|
|
50
|
-
"id": 227,
|
|
51
|
-
"name": "new SkyRichTextDisplayModule",
|
|
52
|
-
"kind": 16384,
|
|
53
|
-
"kindString": "Constructor signature",
|
|
54
|
-
"flags": {},
|
|
55
|
-
"type": {
|
|
56
|
-
"type": "reference",
|
|
57
|
-
"id": 225,
|
|
58
|
-
"name": "SkyRichTextDisplayModule"
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
]
|
|
62
|
-
}
|
|
63
|
-
],
|
|
41
|
+
"children": [],
|
|
64
42
|
"groups": [
|
|
65
43
|
{
|
|
66
44
|
"title": "Constructors",
|
|
@@ -98,29 +76,7 @@
|
|
|
98
76
|
}
|
|
99
77
|
}
|
|
100
78
|
],
|
|
101
|
-
"children": [
|
|
102
|
-
{
|
|
103
|
-
"id": 247,
|
|
104
|
-
"name": "constructor",
|
|
105
|
-
"kind": 512,
|
|
106
|
-
"kindString": "Constructor",
|
|
107
|
-
"flags": {},
|
|
108
|
-
"signatures": [
|
|
109
|
-
{
|
|
110
|
-
"id": 248,
|
|
111
|
-
"name": "new SkyTextEditorModule",
|
|
112
|
-
"kind": 16384,
|
|
113
|
-
"kindString": "Constructor signature",
|
|
114
|
-
"flags": {},
|
|
115
|
-
"type": {
|
|
116
|
-
"type": "reference",
|
|
117
|
-
"id": 246,
|
|
118
|
-
"name": "SkyTextEditorModule"
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
]
|
|
122
|
-
}
|
|
123
|
-
],
|
|
79
|
+
"children": [],
|
|
124
80
|
"groups": [
|
|
125
81
|
{
|
|
126
82
|
"title": "Constructors",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* NOTICE: DO NOT MODIFY THIS FILE!
|
|
3
3
|
* The contents of this file were automatically generated by
|
|
4
|
-
* the 'ng generate @skyux/i18n:lib-resources-module modules/shared/sky-text-editor' schematic.
|
|
4
|
+
* the 'ng generate @skyux/i18n:lib-resources-module lib/modules/shared/sky-text-editor' schematic.
|
|
5
5
|
* To update this file, simply rerun the command.
|
|
6
6
|
*/
|
|
7
7
|
import { NgModule } from '@angular/core';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sky-text-editor-resources.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/text-editor/src/lib/modules/shared/sky-text-editor-resources.module.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EACL,2BAA2B,EAE3B,aAAa,EAGb,qBAAqB,GACtB,MAAM,aAAa,CAAC;;AAErB,MAAM,SAAS,GAA0C;IACvD,OAAO,EAAE;QACP,+CAA+C,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QACpE,sDAAsD,EAAE;YACtD,OAAO,EAAE,QAAQ;SAClB;QACD,iDAAiD,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;QACxE,wDAAwD,EAAE;YACxD,OAAO,EAAE,QAAQ;SAClB;QACD,oDAAoD,EAAE;YACpD,OAAO,EAAE,WAAW;SAC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AE;QACrE,yCAAyC,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE;QACtE,6CAA6C,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QAClE,+CAA+C,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;KACvE;CACF,CAAC;AAEF,MAAM,OAAO,8BAA8B;IAClC,SAAS,
|
|
1
|
+
{"version":3,"file":"sky-text-editor-resources.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/text-editor/src/lib/modules/shared/sky-text-editor-resources.module.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EACL,2BAA2B,EAE3B,aAAa,EAGb,qBAAqB,GACtB,MAAM,aAAa,CAAC;;AAErB,MAAM,SAAS,GAA0C;IACvD,OAAO,EAAE;QACP,+CAA+C,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QACpE,sDAAsD,EAAE;YACtD,OAAO,EAAE,QAAQ;SAClB;QACD,iDAAiD,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;QACxE,wDAAwD,EAAE;YACxD,OAAO,EAAE,QAAQ;SAClB;QACD,oDAAoD,EAAE;YACpD,OAAO,EAAE,WAAW;SACrB;QACD,2DAA2D,EAAE;YAC3D,OAAO,EAAE,QAAQ;SAClB;QACD,wDAAwD,EAAE;YACxD,OAAO,EAAE,eAAe;SACzB;QACD,2DAA2D,EAAE;YAC3D,OAAO,EAAE,kBAAkB;SAC5B;QACD,6CAA6C,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QAClE,oDAAoD,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;QAC3E,6CAA6C,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QAClE,oDAAoD,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;QAC3E,4CAA4C,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;QAChE,mDAAmD,EAAE,EAAE,OAAO,EAAE,QAA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AO,EAAE,2BAA2B;YACpC,QAAQ,EAAE,8BAA8B;YACxC,KAAK,EAAE,IAAI;SACZ;KACF,YAPS,aAAa;4FASZ,4BAA4B;kBAVxC,QAAQ;mBAAC;oBACR,OAAO,EAAE,CAAC,aAAa,CAAC;oBACxB,SAAS,EAAE;wBACT;4BACE,OAAO,EAAE,2BAA2B;4BACpC,QAAQ,EAAE,8BAA8B;4BACxC,KAAK,EAAE,IAAI;yBACZ;qBACF;iBACF","sourcesContent":["/**\n * NOTICE: DO NOT MODIFY THIS FILE!\n * The contents of this file were automatically generated by\n * the 'ng generate @skyux/i18n:lib-resources-module lib/modules/shared/sky-text-editor' schematic.\n * To update this file, simply rerun the command.\n */\nimport { NgModule } from '@angular/core';\nimport {\n SKY_LIB_RESOURCES_PROVIDERS,\n SkyAppLocaleInfo,\n SkyI18nModule,\n SkyLibResources,\n SkyLibResourcesProvider,\n getLibStringForLocale,\n} from '@skyux/i18n';\n\nconst RESOURCES: { [locale: string]: SkyLibResources } = {\n 'EN-US': {\n skyux_text_editor_format_menu_action_bold_label: { message: 'Bold' },\n skyux_text_editor_format_menu_action_bold_key_shortcut: {\n message: 'Ctrl+B',\n },\n skyux_text_editor_format_menu_action_italic_label: { message: 'Italic' },\n skyux_text_editor_format_menu_action_italic_key_shortcut: {\n message: 'Ctrl+I',\n },\n skyux_text_editor_format_menu_action_underline_label: {\n message: 'Underline',\n },\n skyux_text_editor_format_menu_action_underline_key_shortcut: {\n message: 'Ctrl+U',\n },\n skyux_text_editor_format_menu_action_strikethrough_label: {\n message: 'Strikethrough',\n },\n skyux_text_editor_format_menu_action_clear_formatting_label: {\n message: 'Clear formatting',\n },\n skyux_text_editor_edit_menu_action_undo_label: { message: 'Undo' },\n skyux_text_editor_edit_menu_action_undo_key_shortcut: { message: 'Ctrl+Z' },\n skyux_text_editor_edit_menu_action_redo_label: { message: 'Redo' },\n skyux_text_editor_edit_menu_action_redo_key_shortcut: { message: 'Ctrl+Y' },\n skyux_text_editor_edit_menu_action_cut_label: { message: 'Cut' },\n skyux_text_editor_edit_menu_action_cut_key_shortcut: { message: 'Ctrl+X' },\n skyux_text_editor_edit_menu_action_copy_label: { message: 'Copy' },\n skyux_text_editor_edit_menu_action_copy_key_shortcut: { message: 'Ctrl+C' },\n skyux_text_editor_edit_menu_action_paste_label: { message: 'Paste' },\n skyux_text_editor_edit_menu_action_paste_key_shortcut: {\n message: 'Ctrl+V',\n },\n skyux_text_editor_edit_menu_action_select_all_label: {\n message: 'Select all',\n },\n skyux_text_editor_edit_menu_action_select_all_key_shortcut: {\n message: 'Ctrl+A',\n },\n skyux_text_editor_menubar_dropdown_button_edit_label: { message: 'Edit' },\n skyux_text_editor_menubar_dropdown_button_format_label: {\n message: 'Format',\n },\n skyux_text_editor_menubar_dropdown_button_insert_label: {\n message: 'Insert merge field',\n },\n skyux_text_editor_url_modal_header_label: { message: 'Create link' },\n skyux_text_editor_url_modal_url_label: {\n message: 'Enter a URL to link to:',\n },\n skyux_text_editor_url_modal_open_label: {\n message: 'Where should it open?',\n },\n skyux_text_editor_url_modal_current_option_label: {\n message: 'Current window',\n },\n skyux_text_editor_url_modal_new_option_label: { message: 'New window' },\n skyux_text_editor_url_modal_email_label: { message: 'Email address' },\n skyux_text_editor_url_modal_subject_label: { message: 'Subject line' },\n skyux_text_editor_url_modal_save_button_label: { message: 'Save' },\n skyux_text_editor_url_modal_cancel_button_label: { message: 'Cancel' },\n },\n};\n\nexport class SkyTextEditorResourcesProvider implements SkyLibResourcesProvider {\n public getString(\n localeInfo: SkyAppLocaleInfo,\n name: string\n ): string | undefined {\n return getLibStringForLocale(RESOURCES, localeInfo.locale, name);\n }\n}\n\n/**\n * Import into any component library module that needs to use resource strings.\n */\n@NgModule({\n exports: [SkyI18nModule],\n providers: [\n {\n provide: SKY_LIB_RESOURCES_PROVIDERS,\n useClass: SkyTextEditorResourcesProvider,\n multi: true,\n },\n ],\n})\nexport class SkyTextEditorResourcesModule {}\n"]}
|
|
@@ -403,7 +403,8 @@ export class SkyTextEditorAdapterService {
|
|
|
403
403
|
range.deleteContents();
|
|
404
404
|
const el = documentEl.createElement('div');
|
|
405
405
|
el.innerHTML = html;
|
|
406
|
-
|
|
406
|
+
const frag = documentEl.createDocumentFragment();
|
|
407
|
+
let node, lastNode;
|
|
407
408
|
while (el.firstChild) {
|
|
408
409
|
node = el.firstChild;
|
|
409
410
|
lastNode = frag.appendChild(node);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-editor-adapter.service.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/text-editor/src/lib/modules/text-editor/services/text-editor-adapter.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAKxE,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAEhE,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;;;;;AAE7D;;GAEG;AAIH,MAAM,OAAO,2BAA2B;IAKtC,YACU,gBAA+C,EAC/C,iBAAuC,EACvC,aAA8B;QAF9B,qBAAgB,GAAhB,gBAAgB,CAA+B;QAC/C,sBAAiB,GAAjB,iBAAiB,CAAsB;QACvC,kBAAa,GAAb,aAAa,CAAiB;IACrC,CAAC;IARJ,IAAY,OAAO;QACjB,OAAO,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC;IACxC,CAAC;IAQD;;OAEG;IACI,SAAS,CACd,EAAU,EACV,aAAgC,EAChC,UAAmC,EACnC,WAAoB;QAEpB,0BAA0B;QAC1B,IAAI,CAAC,CAAC,EAAE,IAAI,IAAI,CAAC,OAAO,CAAC,EAAE;YACzB,IAAI,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AAG;aACP,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;aAC3C,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;aACrB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;aACrB,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAC5B,CAAC;IAEO,iBAAiB,CACvB,EAAU,EACV,iBAAgC,EAChC,uBAA4B,EAC5B,QAAiB;QAEjB,uBAAuB,CAAC,KAAK,CAAC,aAAa,GAAG,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;QACzE,uBAAuB,CAAC,YAAY,CAClC,eAAe,EACf,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAC5B,CAAC;QACF,0BAA0B;QAC1B,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE;YAChC,iBAAiB,CAAC,OAAO,CAAC,CAAC,eAAe,EAAE,EAAE;gBAC5C,eAAe,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC/C,CAAC,CAAC,CAAC;SACJ;QACD,IAAI,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,CAC5C,iBAAiB,EACjB,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAC5B,CAAC;IACJ,CAAC;;yHAxlBU,2BAA2B;6HAA3B,2BAA2B,cAF1B,MAAM;4FAEP,2BAA2B;kBAHvC,UAAU;mBAAC;oBACV,UAAU,EAAE,MAAM;iBACnB","sourcesContent":["import { Injectable } from '@angular/core';\nimport { SkyAppWindowRef } from '@skyux/core';\n\nimport { Subject } from 'rxjs';\n\nimport { STYLE_STATE_DEFAULTS } from '../defaults/style-state-defaults';\nimport { EditorCommand } from '../types/editor-command';\nimport { EditorSetting } from '../types/editor-setting';\nimport { SkyTextEditorStyleState } from '../types/style-state';\nimport { UrlModalResult } from '../url-modal/text-editor-url-modal-result';\nimport { UrlTarget } from '../url-modal/text-editor-url-target';\n\nimport { SkyTextEditorSelectionService } from './text-editor-selection.service';\nimport { SkyTextEditorService } from './text-editor.service';\n\n/**\n * @internal\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class SkyTextEditorAdapterService {\n private get editors(): { [key: string]: EditorSetting } {\n return this.textEditorService.editors;\n }\n\n constructor(\n private selectionService: SkyTextEditorSelectionService,\n private textEditorService: SkyTextEditorService,\n private windowService: SkyAppWindowRef\n ) {}\n\n /**\n * Creates a text editor inside the supplied iframe element.\n */\n public addEditor(\n id: string,\n iframeElement: HTMLIFrameElement,\n styleState: SkyTextEditorStyleState,\n placeholder?: string\n ): void {\n /* istanbul ignore else */\n if (!(id in this.editors)) {\n this.editors[id] = this.createObservers(id, iframeElement);\n\n const documentEl = this.getIframeDocumentEl(id);\n\n const styleEl = documentEl.createElement('style');\n styleEl.innerHTML = `.editor:empty:before {\n content: attr(data-placeholder);\n font-family: \"Blackbaud Sans\", Arial, sans-serif;\n color: #686c73;\n font-weight: 400;\n font-size: 15px;\n font-style: italic;\n }`;\n documentEl.head.appendChild(styleEl);\n\n const style: SkyTextEditorStyleState = {\n ...STYLE_STATE_DEFAULTS,\n ...styleState,\n };\n const bodyStyle = `background-color: ${style.backColor};\n color: ${style.fontColor};\n font-family: ${style.font};\n font-size: ${style.fontSize}px`;\n documentEl.querySelector('html').setAttribute('lang', 'en');\n documentEl.body.setAttribute('contenteditable', 'true');\n documentEl.body.setAttribute('id', id);\n documentEl.body.setAttribute('role', 'main');\n documentEl.body.setAttribute('class', 'editor');\n documentEl.body.setAttribute('style', bodyStyle);\n documentEl.body.setAttribute('data-placeholder', placeholder || '');\n }\n }\n\n public disableEditor(\n id: string,\n focusableChildren: HTMLElement[],\n textEditorNativeElement: any\n ): void {\n this.setEditorDisabled(\n id,\n focusableChildren,\n textEditorNativeElement,\n true\n );\n }\n\n public enableEditor(\n id: string,\n focusableChildren: HTMLElement[],\n textEditorNativeElement: any\n ): void {\n this.setEditorDisabled(\n id,\n focusableChildren,\n textEditorNativeElement,\n false\n );\n }\n\n /**\n * Executes a command on the text editor with the corresponding id.\n */\n public execCommand(id: string, editorCommand: EditorCommand): void {\n /* istanbul ignore else */\n if (id in this.editors) {\n const documentEl = this.getIframeDocumentEl(id);\n\n /* istanbul ignore else */\n if (this.editorSelected(id)) {\n const commandIsSupportedAndEnabled = documentEl.execCommand(\n editorCommand.command,\n false,\n editorCommand.value\n );\n\n // IE11 doesn't support insertHTML\n /* istanbul ignore next */\n if (\n editorCommand.command.toLowerCase() === 'inserthtml' &&\n !commandIsSupportedAndEnabled\n ) {\n this.insertHtmlInIE11(id, editorCommand.value);\n }\n\n this.focusEditor(id);\n this.editors[id].commandChangeObservable.next();\n }\n }\n }\n\n public getCurrentSelection(id: string): Selection {\n return this.selectionService.getCurrentSelection(\n this.getIframeDocumentEl(id)\n );\n }\n\n /**\n * Returns a data URI using the provided text string.\n * Used to display a merge field inside a string of text.\n */\n public getMergeFieldDataURI(text: string): string {\n const documentEl = this.windowService.nativeWindow.document;\n let textToUse = text;\n if (text.length > 18) {\n textToUse = text.substr(0, 15) + '...';\n }\n\n const canvasElement = documentEl.createElement('canvas');\n canvasElement.setAttribute('height', '20');\n canvasElement.setAttribute('width', '100');\n canvasElement.style.backgroundColor = 'tan';\n canvasElement.style.border = '1px solid #000000';\n canvasElement.style.borderRadius = '5px';\n\n const context = canvasElement.getContext('2d');\n context.font = '12px Arial';\n context.textAlign = 'center';\n context.fillText(textToUse, 50, 15);\n\n context.globalCompositeOperation = 'destination-over';\n context.fillStyle = '#00FFFF';\n context.fillRect(0, 0, 100, 20);\n\n context.globalCompositeOperation = 'source-over';\n context.lineWidth = 2;\n context.strokeStyle = '#FF0000';\n context.strokeRect(0, 0, 100, 20);\n\n const result = canvasElement.toDataURL('image/png', 1.0);\n return result;\n }\n\n public getStyleState(id: string): Partial<SkyTextEditorStyleState> {\n const documentEl = this.getIframeDocumentEl(id);\n\n /* istanbul ignore else */\n if (this.editorSelected(id)) {\n return {\n backColor: this.getColor(documentEl, 'BackColor'),\n fontColor: this.getColor(documentEl, 'ForeColor'),\n fontSize: parseInt(this.getFontSize(id), undefined),\n font: documentEl.queryCommandValue('fontname'),\n boldState: documentEl.queryCommandState('Bold'),\n italicState: documentEl.queryCommandState('Italic'),\n underlineState: documentEl.queryCommandState('Underline'),\n linkState: this.hasLink(id),\n };\n }\n\n /* istanbul ignore next */\n return {};\n }\n\n public getEditorInnerHtml(id: string): string {\n const documentEl = this.getIframeDocumentEl(id);\n if (documentEl) {\n return this.replaceHtmlCodes(documentEl.body.innerHTML);\n }\n return '';\n }\n\n public setEditorInnerHtml(id: string, value: string): void {\n const documentEl = this.getIframeDocumentEl(id);\n const editorContent = documentEl.body;\n /* istanbul ignore else */\n if (editorContent.innerHTML !== value) {\n editorContent.innerHTML = value;\n }\n }\n\n public focusEditor(id: string): void {\n /* istanbul ignore else */\n if (id in this.editors) {\n const windowEl = this.getContentWindowEl(id);\n const iframeDocumentEl = this.getIframeDocumentEl(id);\n const currentSelection = this.selectionService.getCurrentSelectionRange(\n iframeDocumentEl,\n windowEl\n );\n const cursorIsNotActiveAndHasReset =\n currentSelection &&\n currentSelection.startOffset === 0 &&\n currentSelection.endOffset === 0;\n\n if (!this.editorSelected(id) || cursorIsNotActiveAndHasReset) {\n // focus the end of the editor\n const documentEl = this.windowService.nativeWindow.document;\n const editor: any = iframeDocumentEl.body;\n const range = documentEl.createRange();\n\n this.editors[id].iframeElementRef.focus();\n editor.focus();\n /* istanbul ignore else */\n if (windowEl.getSelection && documentEl.createRange) {\n range.selectNodeContents(editor);\n range.collapse(false);\n const sel = windowEl.getSelection();\n sel.removeAllRanges();\n sel.addRange(range);\n } else {\n // IE only\n const textRange = editor.createTextRange();\n textRange.moveToElementText(editor);\n textRange.collapse(false);\n textRange.select();\n }\n } else {\n // Cursor may not be active, restore it\n this.editors[id].iframeElementRef.focus();\n iframeDocumentEl.body.focus();\n }\n }\n }\n\n public getLink(editorId: string): UrlModalResult {\n let link: UrlModalResult = undefined;\n const anchorEl = this.getSelectedAnchorTag(editorId);\n if (anchorEl && anchorEl.href) {\n link = {\n target:\n anchorEl.getAttribute('target') === '_blank'\n ? UrlTarget.NewWindow\n : UrlTarget.None,\n url: anchorEl.href,\n };\n }\n\n return link;\n }\n\n public getSelectedAnchorTag(editorId: string): HTMLAnchorElement {\n const selectedEl = this.getCurrentSelectionParentElement(editorId);\n\n return this.getParent(selectedEl, 'a') as HTMLAnchorElement;\n }\n\n public saveSelection(id: string): Range {\n return this.selectionService.getCurrentSelectionRange(\n this.getIframeDocumentEl(id),\n this.getContentWindowEl(id)\n );\n }\n\n public selectElement(id: string, element: HTMLElement): void {\n this.selectionService.selectElement(\n this.getIframeDocumentEl(id),\n this.getContentWindowEl(id),\n element\n );\n }\n\n public setPlaceholder(id: string, placeholder?: string): void {\n const documentEl = this.getIframeDocumentEl(id);\n documentEl.body.setAttribute('data-placeholder', placeholder || '');\n }\n\n public setFontSize(id: string, fontSize: number): void {\n const doc = this.getIframeDocumentEl(id);\n this.execCommand(id, { command: 'fontSize', value: 1 });\n const fontElements: HTMLElement[] = Array.from(\n doc.querySelectorAll('font[size=\"1\"]')\n );\n for (const element of fontElements) {\n element.removeAttribute('size');\n element.style.fontSize = fontSize + 'px';\n }\n this.cleanUpBlankStyleTags(doc);\n\n this.focusEditor(id);\n this.editors[id].commandChangeObservable.next();\n }\n\n public removeObservers(setting: EditorSetting): void {\n /* istanbul ignore next */\n const documentEl = setting.iframeElementRef.contentWindow\n ? setting.iframeElementRef.contentWindow.document\n : setting.iframeElementRef.contentDocument;\n setting.selectionChangeObservable.complete();\n setting.clickObservable.complete();\n setting.commandChangeObservable.complete();\n documentEl.removeEventListener(\n 'selectionchange',\n setting.selectionListener\n );\n documentEl.removeEventListener('input', setting.selectionListener);\n documentEl.removeEventListener('mousedown', setting.clickListener);\n documentEl.body.removeEventListener('paste', setting.pasteListener);\n }\n\n private getContentWindowEl(id: string): Window {\n return this.editors[id].iframeElementRef.contentWindow;\n }\n\n private getChildSelectedAnchorTags(editorId: string): Element[] {\n const selectedRange = this.getCurrentSelection(editorId).getRangeAt(0);\n if (selectedRange.toString().length <= 0) {\n return [];\n }\n\n const parentElement = this.getCurrentSelectionParentElement(editorId);\n\n let childElements = [];\n /* istanbul ignore else */\n if (parentElement) {\n childElements = Array.from(parentElement.querySelectorAll('a'));\n }\n\n /* istanbul ignore next */\n return childElements.filter((element) => {\n // IE specific\n if (!selectedRange.intersectsNode) {\n if (!element || !element.href) {\n return false;\n }\n const tempRange = document.createRange();\n tempRange.selectNodeContents(element);\n return (\n (selectedRange.compareBoundaryPoints(\n Range.START_TO_START,\n tempRange\n ) !== -1 &&\n selectedRange.compareBoundaryPoints(\n Range.START_TO_END,\n tempRange\n ) !== 1) ||\n (selectedRange.compareBoundaryPoints(\n Range.END_TO_START,\n tempRange\n ) !== -1 &&\n selectedRange.compareBoundaryPoints(Range.END_TO_END, tempRange) !==\n 1)\n );\n }\n\n // Normal non-IE\n return (\n !!element && !!element.href && selectedRange.intersectsNode(element)\n );\n });\n }\n\n private getIframeDocumentEl(id: string): Document {\n /* istanbul ignore next */\n if (!(id in this.editors)) {\n return undefined;\n }\n\n const contentWindowEl = this.getContentWindowEl(id);\n /* istanbul ignore else */\n if (contentWindowEl) {\n return contentWindowEl.document;\n }\n\n /* istanbul ignore next */\n return this.editors[id].iframeElementRef.contentDocument;\n }\n\n private getFontSize(id: string): string {\n let fontSize = STYLE_STATE_DEFAULTS.fontSize.toString();\n const selection = this.getCurrentSelection(id);\n /* istanbul ignore else */\n if (\n selection &&\n selection.anchorNode &&\n selection.anchorNode.parentElement\n ) {\n let element = selection.anchorNode;\n if (element.nodeType !== 1) {\n element = element.parentElement;\n }\n const computedStyle = window.getComputedStyle(element as Element);\n /* istanbul ignore else */\n if (computedStyle) {\n fontSize = computedStyle.getPropertyValue('font-size');\n }\n }\n return fontSize;\n }\n\n private createObservers(\n id: string,\n element: HTMLIFrameElement\n ): EditorSetting {\n /* istanbul ignore next */\n const documentEl = element.contentWindow\n ? element.contentWindow.document\n : element.contentDocument;\n\n // Firefox bug where we need to open/close to cancel load so it doesn't overwrite attrs\n documentEl.open();\n documentEl.close();\n\n const selectionObservable = new Subject();\n const selectionListener = () => selectionObservable.next();\n const clickObservable = new Subject();\n const clickListener = () => clickObservable.next();\n const pasteListener = this.getPasteOverride(id);\n const blurObservable = new Subject();\n const blurListener = () => blurObservable.next();\n const inputObservable = new Subject();\n const inputListener = () => inputObservable.next();\n\n documentEl.addEventListener('selectionchange', selectionListener);\n documentEl.addEventListener('input', inputListener);\n documentEl.addEventListener('mousedown', clickListener);\n documentEl.body.addEventListener('paste', pasteListener);\n documentEl.body.addEventListener('blur', blurListener);\n return {\n blurObservable: blurObservable,\n clickObservable: clickObservable,\n commandChangeObservable: new Subject(),\n iframeElementRef: element,\n inputObservable: inputObservable,\n selectionChangeObservable: selectionObservable,\n blurListener: blurListener,\n clickListener: clickListener,\n inputListener: inputListener,\n pasteListener: pasteListener,\n selectionListener: selectionListener,\n };\n }\n\n /* istanbul ignore next */\n private getPasteOverride(id: string): (e: ClipboardEvent) => void {\n return (e: ClipboardEvent): void => {\n e.preventDefault();\n const text = e.clipboardData.getData('text/plain');\n this.execCommand(id, { command: 'insertHTML', value: text });\n };\n }\n\n private getCurrentSelectionParentElement(id: string): Element {\n return this.selectionService.getCurrentSelectionParentElement(\n this.getIframeDocumentEl(id)\n );\n }\n\n private getColor(documentEl: Document, selector: string): string {\n const commandValue = documentEl.queryCommandValue(selector);\n\n // Edge is weird and returns numbers\n /* istanbul ignore if */\n if (typeof commandValue === 'number') {\n /* istanbul ignore next */\n // tslint:disable-next-line: no-bitwise\n return (\n 'rgb(' +\n (commandValue & 0xff) +\n ', ' +\n // tslint:disable-next-line: no-bitwise\n ((commandValue & 0xff00) >> 8) +\n ', ' +\n // tslint:disable-next-line: no-bitwise\n ((commandValue & 0xff0000) >> 16) +\n ')'\n );\n }\n\n // Firefox uses 'Transparent' instead of a color value\n /* istanbul ignore next */\n if (commandValue.toString().toLowerCase() === 'transparent') {\n return STYLE_STATE_DEFAULTS.backColor;\n }\n return commandValue;\n }\n\n private hasLink(editorId: string): boolean {\n const anchorEl = this.getSelectedAnchorTag(editorId);\n const childAnchorEls = this.getChildSelectedAnchorTags(editorId);\n /* istanbul ignore next */\n return childAnchorEls.length > 0 || (!!anchorEl && !!anchorEl.href);\n }\n\n private getParent(element: Element, tag: string): Element {\n let currentNode = element;\n while (currentNode && currentNode.tagName.toUpperCase() !== 'BODY') {\n if (currentNode.tagName.toUpperCase() === tag.toUpperCase()) {\n return currentNode;\n }\n currentNode = currentNode.parentElement;\n }\n return undefined;\n }\n\n private editorSelected(id: string): boolean {\n const documentEl = this.getIframeDocumentEl(id);\n return this.selectionService.isElementSelected(documentEl, documentEl.body);\n }\n\n /* istanbul ignore next */\n private insertHtmlInIE11(id: string, html: string): void {\n const documentEl = this.getIframeDocumentEl(id);\n const windowEl = this.getContentWindowEl(id);\n const sel = windowEl.getSelection();\n if (sel.getRangeAt && sel.rangeCount) {\n let range = sel.getRangeAt(0);\n range.deleteContents();\n\n const el = documentEl.createElement('div');\n el.innerHTML = html;\n let frag = documentEl.createDocumentFragment(),\n node,\n lastNode;\n while (el.firstChild) {\n node = el.firstChild;\n lastNode = frag.appendChild(node);\n }\n range.insertNode(frag);\n\n // Preserve the selection\n if (lastNode) {\n range = range.cloneRange();\n range.setStartAfter(lastNode);\n range.collapse(true);\n sel.removeAllRanges();\n sel.addRange(range);\n }\n }\n }\n\n private cleanUpBlankStyleTags(doc: Document): void {\n const orphanElements: HTMLElement[] = Array.from(\n doc.querySelectorAll('font,span,*[style=\"\"]')\n );\n for (const element of orphanElements) {\n if (!element.getAttribute('style')) {\n element.removeAttribute('style');\n }\n }\n const removableElements = orphanElements.filter((element) => {\n const tagName = element.tagName.toUpperCase();\n return (\n (tagName === 'FONT' || tagName === 'SPAN') &&\n (element.attributes.length === 0 || !element.hasChildNodes)\n );\n });\n for (const element of removableElements) {\n const parent = element.parentNode;\n /* istanbul ignore else */\n if (parent) {\n while (element.firstChild) {\n parent.insertBefore(element.firstChild, element);\n }\n parent.removeChild(element);\n }\n }\n }\n\n // Certain values are encoded in html and need to be decoded\n private replaceHtmlCodes(str: string): string {\n return str\n .replace(/ /, String.fromCharCode(160))\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/&/g, '&');\n }\n\n private setEditorDisabled(\n id: string,\n focusableChildren: HTMLElement[],\n textEditorNativeElement: any,\n disabled: boolean\n ): void {\n textEditorNativeElement.style.pointerEvents = disabled ? 'none' : 'auto';\n textEditorNativeElement.setAttribute(\n 'aria-disabled',\n disabled ? 'true' : 'false'\n );\n /* istanbul ignore else */\n if (focusableChildren.length > 0) {\n focusableChildren.forEach((aFocusableChild) => {\n aFocusableChild.tabIndex = disabled ? -1 : 0;\n });\n }\n this.getIframeDocumentEl(id).body.setAttribute(\n 'contenteditable',\n disabled ? 'false' : 'true'\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"text-editor-adapter.service.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/text-editor/src/lib/modules/text-editor/services/text-editor-adapter.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAKxE,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAEhE,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;;;;;AAE7D;;GAEG;AAIH,MAAM,OAA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B,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,CAC5C,iBAAiB,EACjB,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAC5B,CAAC;IACJ,CAAC;;yHAvlBU,2BAA2B;6HAA3B,2BAA2B,cAF1B,MAAM;4FAEP,2BAA2B;kBAHvC,UAAU;mBAAC;oBACV,UAAU,EAAE,MAAM;iBACnB","sourcesContent":["import { Injectable } from '@angular/core';\nimport { SkyAppWindowRef } from '@skyux/core';\n\nimport { Subject } from 'rxjs';\n\nimport { STYLE_STATE_DEFAULTS } from '../defaults/style-state-defaults';\nimport { EditorCommand } from '../types/editor-command';\nimport { EditorSetting } from '../types/editor-setting';\nimport { SkyTextEditorStyleState } from '../types/style-state';\nimport { UrlModalResult } from '../url-modal/text-editor-url-modal-result';\nimport { UrlTarget } from '../url-modal/text-editor-url-target';\n\nimport { SkyTextEditorSelectionService } from './text-editor-selection.service';\nimport { SkyTextEditorService } from './text-editor.service';\n\n/**\n * @internal\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class SkyTextEditorAdapterService {\n private get editors(): { [key: string]: EditorSetting } {\n return this.textEditorService.editors;\n }\n\n constructor(\n private selectionService: SkyTextEditorSelectionService,\n private textEditorService: SkyTextEditorService,\n private windowService: SkyAppWindowRef\n ) {}\n\n /**\n * Creates a text editor inside the supplied iframe element.\n */\n public addEditor(\n id: string,\n iframeElement: HTMLIFrameElement,\n styleState: SkyTextEditorStyleState,\n placeholder?: string\n ): void {\n /* istanbul ignore else */\n if (!(id in this.editors)) {\n this.editors[id] = this.createObservers(id, iframeElement);\n\n const documentEl = this.getIframeDocumentEl(id);\n\n const styleEl = documentEl.createElement('style');\n styleEl.innerHTML = `.editor:empty:before {\n content: attr(data-placeholder);\n font-family: \"Blackbaud Sans\", Arial, sans-serif;\n color: #686c73;\n font-weight: 400;\n font-size: 15px;\n font-style: italic;\n }`;\n documentEl.head.appendChild(styleEl);\n\n const style: SkyTextEditorStyleState = {\n ...STYLE_STATE_DEFAULTS,\n ...styleState,\n };\n const bodyStyle = `background-color: ${style.backColor};\n color: ${style.fontColor};\n font-family: ${style.font};\n font-size: ${style.fontSize}px`;\n documentEl.querySelector('html').setAttribute('lang', 'en');\n documentEl.body.setAttribute('contenteditable', 'true');\n documentEl.body.setAttribute('id', id);\n documentEl.body.setAttribute('role', 'main');\n documentEl.body.setAttribute('class', 'editor');\n documentEl.body.setAttribute('style', bodyStyle);\n documentEl.body.setAttribute('data-placeholder', placeholder || '');\n }\n }\n\n public disableEditor(\n id: string,\n focusableChildren: HTMLElement[],\n textEditorNativeElement: any\n ): void {\n this.setEditorDisabled(\n id,\n focusableChildren,\n textEditorNativeElement,\n true\n );\n }\n\n public enableEditor(\n id: string,\n focusableChildren: HTMLElement[],\n textEditorNativeElement: any\n ): void {\n this.setEditorDisabled(\n id,\n focusableChildren,\n textEditorNativeElement,\n false\n );\n }\n\n /**\n * Executes a command on the text editor with the corresponding id.\n */\n public execCommand(id: string, editorCommand: EditorCommand): void {\n /* istanbul ignore else */\n if (id in this.editors) {\n const documentEl = this.getIframeDocumentEl(id);\n\n /* istanbul ignore else */\n if (this.editorSelected(id)) {\n const commandIsSupportedAndEnabled = documentEl.execCommand(\n editorCommand.command,\n false,\n editorCommand.value\n );\n\n // IE11 doesn't support insertHTML\n /* istanbul ignore next */\n if (\n editorCommand.command.toLowerCase() === 'inserthtml' &&\n !commandIsSupportedAndEnabled\n ) {\n this.insertHtmlInIE11(id, editorCommand.value);\n }\n\n this.focusEditor(id);\n this.editors[id].commandChangeObservable.next();\n }\n }\n }\n\n public getCurrentSelection(id: string): Selection {\n return this.selectionService.getCurrentSelection(\n this.getIframeDocumentEl(id)\n );\n }\n\n /**\n * Returns a data URI using the provided text string.\n * Used to display a merge field inside a string of text.\n */\n public getMergeFieldDataURI(text: string): string {\n const documentEl = this.windowService.nativeWindow.document;\n let textToUse = text;\n if (text.length > 18) {\n textToUse = text.substr(0, 15) + '...';\n }\n\n const canvasElement = documentEl.createElement('canvas');\n canvasElement.setAttribute('height', '20');\n canvasElement.setAttribute('width', '100');\n canvasElement.style.backgroundColor = 'tan';\n canvasElement.style.border = '1px solid #000000';\n canvasElement.style.borderRadius = '5px';\n\n const context = canvasElement.getContext('2d');\n context.font = '12px Arial';\n context.textAlign = 'center';\n context.fillText(textToUse, 50, 15);\n\n context.globalCompositeOperation = 'destination-over';\n context.fillStyle = '#00FFFF';\n context.fillRect(0, 0, 100, 20);\n\n context.globalCompositeOperation = 'source-over';\n context.lineWidth = 2;\n context.strokeStyle = '#FF0000';\n context.strokeRect(0, 0, 100, 20);\n\n const result = canvasElement.toDataURL('image/png', 1.0);\n return result;\n }\n\n public getStyleState(id: string): Partial<SkyTextEditorStyleState> {\n const documentEl = this.getIframeDocumentEl(id);\n\n /* istanbul ignore else */\n if (this.editorSelected(id)) {\n return {\n backColor: this.getColor(documentEl, 'BackColor'),\n fontColor: this.getColor(documentEl, 'ForeColor'),\n fontSize: parseInt(this.getFontSize(id), undefined),\n font: documentEl.queryCommandValue('fontname'),\n boldState: documentEl.queryCommandState('Bold'),\n italicState: documentEl.queryCommandState('Italic'),\n underlineState: documentEl.queryCommandState('Underline'),\n linkState: this.hasLink(id),\n };\n }\n\n /* istanbul ignore next */\n return {};\n }\n\n public getEditorInnerHtml(id: string): string {\n const documentEl = this.getIframeDocumentEl(id);\n if (documentEl) {\n return this.replaceHtmlCodes(documentEl.body.innerHTML);\n }\n return '';\n }\n\n public setEditorInnerHtml(id: string, value: string): void {\n const documentEl = this.getIframeDocumentEl(id);\n const editorContent = documentEl.body;\n /* istanbul ignore else */\n if (editorContent.innerHTML !== value) {\n editorContent.innerHTML = value;\n }\n }\n\n public focusEditor(id: string): void {\n /* istanbul ignore else */\n if (id in this.editors) {\n const windowEl = this.getContentWindowEl(id);\n const iframeDocumentEl = this.getIframeDocumentEl(id);\n const currentSelection = this.selectionService.getCurrentSelectionRange(\n iframeDocumentEl,\n windowEl\n );\n const cursorIsNotActiveAndHasReset =\n currentSelection &&\n currentSelection.startOffset === 0 &&\n currentSelection.endOffset === 0;\n\n if (!this.editorSelected(id) || cursorIsNotActiveAndHasReset) {\n // focus the end of the editor\n const documentEl = this.windowService.nativeWindow.document;\n const editor: any = iframeDocumentEl.body;\n const range = documentEl.createRange();\n\n this.editors[id].iframeElementRef.focus();\n editor.focus();\n /* istanbul ignore else */\n if (windowEl.getSelection && documentEl.createRange) {\n range.selectNodeContents(editor);\n range.collapse(false);\n const sel = windowEl.getSelection();\n sel.removeAllRanges();\n sel.addRange(range);\n } else {\n // IE only\n const textRange = editor.createTextRange();\n textRange.moveToElementText(editor);\n textRange.collapse(false);\n textRange.select();\n }\n } else {\n // Cursor may not be active, restore it\n this.editors[id].iframeElementRef.focus();\n iframeDocumentEl.body.focus();\n }\n }\n }\n\n public getLink(editorId: string): UrlModalResult {\n let link: UrlModalResult = undefined;\n const anchorEl = this.getSelectedAnchorTag(editorId);\n if (anchorEl && anchorEl.href) {\n link = {\n target:\n anchorEl.getAttribute('target') === '_blank'\n ? UrlTarget.NewWindow\n : UrlTarget.None,\n url: anchorEl.href,\n };\n }\n\n return link;\n }\n\n public getSelectedAnchorTag(editorId: string): HTMLAnchorElement {\n const selectedEl = this.getCurrentSelectionParentElement(editorId);\n\n return this.getParent(selectedEl, 'a') as HTMLAnchorElement;\n }\n\n public saveSelection(id: string): Range {\n return this.selectionService.getCurrentSelectionRange(\n this.getIframeDocumentEl(id),\n this.getContentWindowEl(id)\n );\n }\n\n public selectElement(id: string, element: HTMLElement): void {\n this.selectionService.selectElement(\n this.getIframeDocumentEl(id),\n this.getContentWindowEl(id),\n element\n );\n }\n\n public setPlaceholder(id: string, placeholder?: string): void {\n const documentEl = this.getIframeDocumentEl(id);\n documentEl.body.setAttribute('data-placeholder', placeholder || '');\n }\n\n public setFontSize(id: string, fontSize: number): void {\n const doc = this.getIframeDocumentEl(id);\n this.execCommand(id, { command: 'fontSize', value: 1 });\n const fontElements: HTMLElement[] = Array.from(\n doc.querySelectorAll('font[size=\"1\"]')\n );\n for (const element of fontElements) {\n element.removeAttribute('size');\n element.style.fontSize = fontSize + 'px';\n }\n this.cleanUpBlankStyleTags(doc);\n\n this.focusEditor(id);\n this.editors[id].commandChangeObservable.next();\n }\n\n public removeObservers(setting: EditorSetting): void {\n /* istanbul ignore next */\n const documentEl = setting.iframeElementRef.contentWindow\n ? setting.iframeElementRef.contentWindow.document\n : setting.iframeElementRef.contentDocument;\n setting.selectionChangeObservable.complete();\n setting.clickObservable.complete();\n setting.commandChangeObservable.complete();\n documentEl.removeEventListener(\n 'selectionchange',\n setting.selectionListener\n );\n documentEl.removeEventListener('input', setting.selectionListener);\n documentEl.removeEventListener('mousedown', setting.clickListener);\n documentEl.body.removeEventListener('paste', setting.pasteListener);\n }\n\n private getContentWindowEl(id: string): Window {\n return this.editors[id].iframeElementRef.contentWindow;\n }\n\n private getChildSelectedAnchorTags(editorId: string): Element[] {\n const selectedRange = this.getCurrentSelection(editorId).getRangeAt(0);\n if (selectedRange.toString().length <= 0) {\n return [];\n }\n\n const parentElement = this.getCurrentSelectionParentElement(editorId);\n\n let childElements = [];\n /* istanbul ignore else */\n if (parentElement) {\n childElements = Array.from(parentElement.querySelectorAll('a'));\n }\n\n /* istanbul ignore next */\n return childElements.filter((element) => {\n // IE specific\n if (!selectedRange.intersectsNode) {\n if (!element || !element.href) {\n return false;\n }\n const tempRange = document.createRange();\n tempRange.selectNodeContents(element);\n return (\n (selectedRange.compareBoundaryPoints(\n Range.START_TO_START,\n tempRange\n ) !== -1 &&\n selectedRange.compareBoundaryPoints(\n Range.START_TO_END,\n tempRange\n ) !== 1) ||\n (selectedRange.compareBoundaryPoints(\n Range.END_TO_START,\n tempRange\n ) !== -1 &&\n selectedRange.compareBoundaryPoints(Range.END_TO_END, tempRange) !==\n 1)\n );\n }\n\n // Normal non-IE\n return (\n !!element && !!element.href && selectedRange.intersectsNode(element)\n );\n });\n }\n\n private getIframeDocumentEl(id: string): Document {\n /* istanbul ignore next */\n if (!(id in this.editors)) {\n return undefined;\n }\n\n const contentWindowEl = this.getContentWindowEl(id);\n /* istanbul ignore else */\n if (contentWindowEl) {\n return contentWindowEl.document;\n }\n\n /* istanbul ignore next */\n return this.editors[id].iframeElementRef.contentDocument;\n }\n\n private getFontSize(id: string): string {\n let fontSize = STYLE_STATE_DEFAULTS.fontSize.toString();\n const selection = this.getCurrentSelection(id);\n /* istanbul ignore else */\n if (\n selection &&\n selection.anchorNode &&\n selection.anchorNode.parentElement\n ) {\n let element = selection.anchorNode;\n if (element.nodeType !== 1) {\n element = element.parentElement;\n }\n const computedStyle = window.getComputedStyle(element as Element);\n /* istanbul ignore else */\n if (computedStyle) {\n fontSize = computedStyle.getPropertyValue('font-size');\n }\n }\n return fontSize;\n }\n\n private createObservers(\n id: string,\n element: HTMLIFrameElement\n ): EditorSetting {\n /* istanbul ignore next */\n const documentEl = element.contentWindow\n ? element.contentWindow.document\n : element.contentDocument;\n\n // Firefox bug where we need to open/close to cancel load so it doesn't overwrite attrs\n documentEl.open();\n documentEl.close();\n\n const selectionObservable = new Subject();\n const selectionListener = () => selectionObservable.next();\n const clickObservable = new Subject();\n const clickListener = () => clickObservable.next();\n const pasteListener = this.getPasteOverride(id);\n const blurObservable = new Subject();\n const blurListener = () => blurObservable.next();\n const inputObservable = new Subject();\n const inputListener = () => inputObservable.next();\n\n documentEl.addEventListener('selectionchange', selectionListener);\n documentEl.addEventListener('input', inputListener);\n documentEl.addEventListener('mousedown', clickListener);\n documentEl.body.addEventListener('paste', pasteListener);\n documentEl.body.addEventListener('blur', blurListener);\n return {\n blurObservable: blurObservable,\n clickObservable: clickObservable,\n commandChangeObservable: new Subject(),\n iframeElementRef: element,\n inputObservable: inputObservable,\n selectionChangeObservable: selectionObservable,\n blurListener: blurListener,\n clickListener: clickListener,\n inputListener: inputListener,\n pasteListener: pasteListener,\n selectionListener: selectionListener,\n };\n }\n\n /* istanbul ignore next */\n private getPasteOverride(id: string): (e: ClipboardEvent) => void {\n return (e: ClipboardEvent): void => {\n e.preventDefault();\n const text = e.clipboardData.getData('text/plain');\n this.execCommand(id, { command: 'insertHTML', value: text });\n };\n }\n\n private getCurrentSelectionParentElement(id: string): Element {\n return this.selectionService.getCurrentSelectionParentElement(\n this.getIframeDocumentEl(id)\n );\n }\n\n private getColor(documentEl: Document, selector: string): string {\n const commandValue = documentEl.queryCommandValue(selector);\n\n // Edge is weird and returns numbers\n /* istanbul ignore if */\n if (typeof commandValue === 'number') {\n /* istanbul ignore next */\n // tslint:disable-next-line: no-bitwise\n return (\n 'rgb(' +\n (commandValue & 0xff) +\n ', ' +\n // tslint:disable-next-line: no-bitwise\n ((commandValue & 0xff00) >> 8) +\n ', ' +\n // tslint:disable-next-line: no-bitwise\n ((commandValue & 0xff0000) >> 16) +\n ')'\n );\n }\n\n // Firefox uses 'Transparent' instead of a color value\n /* istanbul ignore next */\n if (commandValue.toString().toLowerCase() === 'transparent') {\n return STYLE_STATE_DEFAULTS.backColor;\n }\n return commandValue;\n }\n\n private hasLink(editorId: string): boolean {\n const anchorEl = this.getSelectedAnchorTag(editorId);\n const childAnchorEls = this.getChildSelectedAnchorTags(editorId);\n /* istanbul ignore next */\n return childAnchorEls.length > 0 || (!!anchorEl && !!anchorEl.href);\n }\n\n private getParent(element: Element, tag: string): Element {\n let currentNode = element;\n while (currentNode && currentNode.tagName.toUpperCase() !== 'BODY') {\n if (currentNode.tagName.toUpperCase() === tag.toUpperCase()) {\n return currentNode;\n }\n currentNode = currentNode.parentElement;\n }\n return undefined;\n }\n\n private editorSelected(id: string): boolean {\n const documentEl = this.getIframeDocumentEl(id);\n return this.selectionService.isElementSelected(documentEl, documentEl.body);\n }\n\n /* istanbul ignore next */\n private insertHtmlInIE11(id: string, html: string): void {\n const documentEl = this.getIframeDocumentEl(id);\n const windowEl = this.getContentWindowEl(id);\n const sel = windowEl.getSelection();\n if (sel.getRangeAt && sel.rangeCount) {\n let range = sel.getRangeAt(0);\n range.deleteContents();\n\n const el = documentEl.createElement('div');\n el.innerHTML = html;\n const frag = documentEl.createDocumentFragment();\n let node, lastNode;\n while (el.firstChild) {\n node = el.firstChild;\n lastNode = frag.appendChild(node);\n }\n range.insertNode(frag);\n\n // Preserve the selection\n if (lastNode) {\n range = range.cloneRange();\n range.setStartAfter(lastNode);\n range.collapse(true);\n sel.removeAllRanges();\n sel.addRange(range);\n }\n }\n }\n\n private cleanUpBlankStyleTags(doc: Document): void {\n const orphanElements: HTMLElement[] = Array.from(\n doc.querySelectorAll('font,span,*[style=\"\"]')\n );\n for (const element of orphanElements) {\n if (!element.getAttribute('style')) {\n element.removeAttribute('style');\n }\n }\n const removableElements = orphanElements.filter((element) => {\n const tagName = element.tagName.toUpperCase();\n return (\n (tagName === 'FONT' || tagName === 'SPAN') &&\n (element.attributes.length === 0 || !element.hasChildNodes)\n );\n });\n for (const element of removableElements) {\n const parent = element.parentNode;\n /* istanbul ignore else */\n if (parent) {\n while (element.firstChild) {\n parent.insertBefore(element.firstChild, element);\n }\n parent.removeChild(element);\n }\n }\n }\n\n // Certain values are encoded in html and need to be decoded\n private replaceHtmlCodes(str: string): string {\n return str\n .replace(/ /, String.fromCharCode(160))\n .replace(/</g, '<')\n .replace(/>/g, '>')\n .replace(/&/g, '&');\n }\n\n private setEditorDisabled(\n id: string,\n focusableChildren: HTMLElement[],\n textEditorNativeElement: any,\n disabled: boolean\n ): void {\n textEditorNativeElement.style.pointerEvents = disabled ? 'none' : 'auto';\n textEditorNativeElement.setAttribute(\n 'aria-disabled',\n disabled ? 'true' : 'false'\n );\n /* istanbul ignore else */\n if (focusableChildren.length > 0) {\n focusableChildren.forEach((aFocusableChild) => {\n aFocusableChild.tabIndex = disabled ? -1 : 0;\n });\n }\n this.getIframeDocumentEl(id).body.setAttribute(\n 'contenteditable',\n disabled ? 'false' : 'true'\n );\n }\n}\n"]}
|
|
@@ -79,9 +79,9 @@ export class SkyTextEditorComponent {
|
|
|
79
79
|
this._initialStyleState = Object.assign({}, STYLE_STATE_DEFAULTS);
|
|
80
80
|
this._placeholder = '';
|
|
81
81
|
this._value = '<p></p>';
|
|
82
|
-
|
|
82
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
83
83
|
this._onTouched = () => { };
|
|
84
|
-
|
|
84
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
85
85
|
this._onChange = () => { };
|
|
86
86
|
this.ngControl.valueAccessor = this;
|
|
87
87
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-editor.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/text-editor/src/lib/modules/text-editor/text-editor.component.ts","../../../../../../../../libs/components/text-editor/src/lib/modules/text-editor/text-editor.component.html"],"names":[],"mappings":"AAAA,OAAO,EAEL,uBAAuB,EACvB,iBAAiB,EACjB,SAAS,EACT,UAAU,EACV,KAAK,EACL,MAAM,EAEN,SAAS,EACT,iBAAiB,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEpD,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,O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AAC,cAAc,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC7D,0BAA0B;QAC1B,IAAI,UAAU,EAAE;YACd,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SAC7B;IACH,CAAC;;oHA7UU,sBAAsB;wGAAtB,sBAAsB,saCjDnC,quCA6CA;4FDIa,sBAAsB;kBAPlC,SAAS;mBAAC;oBACT,QAAQ,EAAE,iBAAiB;oBAC3B,WAAW,EAAE,8BAA8B;oBAC3C,SAAS,EAAE,CAAC,8BAA8B,CAAC;oBAC3C,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,aAAa,EAAE,iBAAiB,CAAC,IAAI;iBACtC;+SAMQ,SAAS;sBADf,KAAK;gBAQK,QAAQ;sBADlB,KAAK;gBA+CC,QAAQ;sBADd,KAAK;gBAQC,YAAY;sBADlB,KAAK;gBAQC,EAAE;sBADR,KAAK;gBAOK,iBAAiB;sBAD3B,KAAK;gBAqBC,KAAK;sBADX,KAAK;gBAOC,WAAW;sBADjB,KAAK;gBAOK,WAAW;sBADrB,KAAK;gBAoBC,cAAc;sBADpB,KAAK;gBAiDE,SAAS;sBADhB,SAAS;uBAAC,QAAQ","sourcesContent":["import {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n Input,\n NgZone,\n OnDestroy,\n ViewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport { NgControl } from '@angular/forms';\nimport { SkyCoreAdapterService } from '@skyux/core';\n\nimport { Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { SkyFormsUtility } from '../shared/forms-utility';\n\nimport { FONT_LIST_DEFAULTS } from './defaults/font-list-defaults';\nimport { FONT_SIZE_LIST_DEFAULTS } from './defaults/font-size-list-defaults';\nimport { MENU_DEFAULTS } from './defaults/menu-defaults';\nimport { STYLE_STATE_DEFAULTS } from './defaults/style-state-defaults';\nimport { TOOLBAR_ACTION_DEFAULTS } from './defaults/toolbar-action-defaults';\nimport { SkyTextEditorAdapterService } from './services/text-editor-adapter.service';\nimport { SkyTextEditorService } from './services/text-editor.service';\nimport { SkyTextSanitizationService } from './services/text-sanitization.service';\nimport { SkyTextEditorFont } from './types/font-state';\nimport { SkyTextEditorMenuType } from './types/menu-type';\nimport { SkyTextEditorStyleState } from './types/style-state';\nimport { SkyTextEditorMergeField } from './types/text-editor-merge-field';\nimport { SkyTextEditorToolbarActionType } from './types/toolbar-action-type';\n\n/**\n * Auto-incrementing integer used to generate unique ids for radio components.\n */\nlet nextUniqueId = 0;\n\n/**\n * The text editor component lets users format and manipulate text.\n */\n@Component({\n selector: 'sky-text-editor',\n templateUrl: './text-editor.component.html',\n styleUrls: ['./text-editor.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n})\nexport class SkyTextEditorComponent implements AfterViewInit, OnDestroy {\n /**\n * Indicates whether to put focus on the editor after it renders.\n */\n @Input()\n public autofocus = false;\n\n /**\n * Indicates whether to disable the text editor.\n * @default false\n */\n @Input()\n public set disabled(value: boolean) {\n const coercedValue = SkyFormsUtility.coerceBooleanProperty(value);\n if (coercedValue !== this.disabled) {\n this._disabled = coercedValue;\n\n // Update focusableChildren inside the iframe.\n let focusableChildren: HTMLElement[];\n /* istanbul ignore else */\n if (this.iframeRef) {\n focusableChildren = this.coreAdapterService.getFocusableChildren(\n this.iframeRef.nativeElement.contentDocument.body,\n {\n ignoreVisibility: true,\n ignoreTabIndex: true,\n }\n );\n }\n\n if (this._disabled) {\n this.adapterService.disableEditor(\n this.id,\n focusableChildren,\n this.iframeRef.nativeElement\n );\n } else {\n this.adapterService.enableEditor(\n this.id,\n focusableChildren,\n this.iframeRef.nativeElement\n );\n }\n this.changeDetector.markForCheck();\n }\n }\n\n public get disabled() {\n return this._disabled;\n }\n\n public editorFocusStream = new Subject();\n\n /**\n * Specifies the fonts to include in the font picker.\n * @default [{name: 'Blackbaud Sans', value: '\"Blackbaud Sans\", Arial, sans-serif'}, {name: 'Arial', value: 'Arial'}, {name: 'Arial Black', value: '\"Arial Black\"'}, {name: 'Courier New', value: '\"Courier New\"'}, {name: 'Georgia', value: 'Georgia, serif'}, {name: 'Tahoma', value: 'Tahoma, Geneva, sans-serif'}, {name: 'Times New Roman', value: '\"Times New Roman\"'}, {name: 'Trebuchet MS', value: '\"Trebuchet MS\", sans-serif'}, {name: 'Verdana', value: 'Verdana, Geneva, sans-serif'}]\n */\n @Input()\n public fontList: SkyTextEditorFont[] = FONT_LIST_DEFAULTS;\n\n /**\n * Specifies the font sizes to include in the font size picker.\n * @default [6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 22, 24, 26, 28, 36, 48]\n */\n @Input()\n public fontSizeList: number[] = FONT_SIZE_LIST_DEFAULTS;\n\n /**\n * Specifies a unique ID attribute for the text editor.\n * By default, the component generates a random ID.\n */\n @Input()\n public id = `sky-text-editor-${++nextUniqueId}`;\n\n /**\n * Specifies the initial styles for all content, including background color, font size, and link state.\n */\n @Input()\n public set initialStyleState(state: SkyTextEditorStyleState) {\n // Do not update the state after initialization has taken place\n /* istanbul ignore else */\n if (!this.initialized) {\n this._initialStyleState = {\n ...STYLE_STATE_DEFAULTS,\n ...state,\n };\n }\n }\n\n public get initialStyleState(): SkyTextEditorStyleState {\n return this._initialStyleState;\n }\n\n /**\n * Specifies the menus to include in the menu bar.\n * @default [ 'edit', 'format' ]\n */\n @Input()\n public menus: SkyTextEditorMenuType[] = MENU_DEFAULTS;\n\n /**\n * Specifies the merge fields to include in the merge field menu.\n */\n @Input()\n public mergeFields: SkyTextEditorMergeField[] = [];\n\n /**\n * Specifies placeholder text to display when the text entry area is empty.\n */\n @Input()\n public set placeholder(value: string) {\n /* istanbul ignore else */\n if (value !== this._placeholder) {\n this._placeholder = value;\n if (this.initialized) {\n this.adapterService.setPlaceholder(this.id, value);\n }\n }\n }\n\n public get placeholder(): string {\n return this._placeholder;\n }\n\n /**\n * Specifies the actions to include in the toolbar and determines their order.\n * @default [ 'font-family', 'font-size', 'font-style', 'color', 'list', 'link ]\n */\n @Input()\n public toolbarActions: SkyTextEditorToolbarActionType[] = TOOLBAR_ACTION_DEFAULTS;\n\n /**\n * The internal value of the control.\n */\n public set value(value: string) {\n // Normalize value and set any empty state to an empty string.\n let normalizedValue: string = value;\n if (\n !value ||\n value.trim() === '<p></p>' ||\n value.trim() === '<br>' ||\n value.trim() === '<p><br></p>'\n ) {\n normalizedValue = '';\n }\n normalizedValue = this.sanitizationService.sanitize(normalizedValue).trim();\n\n if (this._value !== normalizedValue) {\n this._value = normalizedValue;\n\n // Update angular form control if model has been normalized.\n /* istanbul ignore else */\n if (this.ngControl && this.ngControl.control) {\n /* istanbul ignore else */\n if (normalizedValue !== this.ngControl.control.value) {\n this.ngControl.control.setValue(normalizedValue, {\n emitModelToViewChange: false,\n });\n }\n }\n\n // Autofocus isn't testable in Firefox and IE.\n /* istanbul ignore next */\n if (this.autofocus && !this.focusInitialized) {\n this.adapterService.focusEditor(this.id);\n this.focusInitialized = true;\n }\n }\n }\n\n public get value(): string {\n return this._value;\n }\n\n private focusInitialized = false;\n\n @ViewChild('iframe')\n private iframeRef: ElementRef;\n\n private initialized = false;\n\n private ngUnsubscribe = new Subject<void>();\n\n private _disabled = false;\n\n private _initialStyleState = Object.assign({}, STYLE_STATE_DEFAULTS);\n\n private _placeholder = '';\n\n private _value = '<p></p>';\n\n constructor(\n private changeDetector: ChangeDetectorRef,\n private coreAdapterService: SkyCoreAdapterService,\n private adapterService: SkyTextEditorAdapterService,\n private editorService: SkyTextEditorService,\n private sanitizationService: SkyTextSanitizationService,\n private ngControl: NgControl,\n private zone: NgZone\n ) {\n this.ngControl.valueAccessor = this;\n }\n\n public ngAfterViewInit(): void {\n this.initIframe();\n }\n\n public ngOnDestroy(): void {\n this.adapterService.removeObservers(this.editorService.editors[this.id]);\n this.editorService.removeEditor(this.id);\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n }\n\n public onIframeLoad(): void {\n // Remove editor if it already exists to cover situations where the text editor might have been moved in the DOM.\n /* istanbul ignore else */\n if (this.editorService.editors[this.id]) {\n this.editorService.removeEditor(this.id);\n this.initIframe();\n }\n }\n\n /**\n * Implemented as part of ControlValueAccessor.\n */\n public writeValue(value: string): void {\n this.value = value;\n\n // Update HTML if necessary.\n const editorValue = this.adapterService.getEditorInnerHtml(this.id);\n if (this.initialized && editorValue !== this._value) {\n this.adapterService.setEditorInnerHtml(this.id, this._value);\n }\n }\n\n /**\n * Implemented as part of ControlValueAccessor.\n */\n public registerOnChange(fn: (value: any) => void): void {\n this._onChange = fn;\n }\n\n /**\n * Implemented as part of ControlValueAccessor.\n */\n public registerOnTouched(fn: () => void): void {\n this._onTouched = fn;\n }\n\n /**\n * Implemented as part of ControlValueAccessor.\n */\n public setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n }\n\n private updateStyle(): void {\n this._initialStyleState = {\n ...this._initialStyleState,\n ...(this.adapterService.getStyleState(this.id) as any),\n };\n }\n\n private initIframe(): void {\n this.adapterService.addEditor(\n this.id,\n this.iframeRef.nativeElement,\n this.initialStyleState,\n this.placeholder\n );\n\n this.editorService\n .inputListener(this.id)\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => {\n // Angular doesn't run change detection for changes originating inside an iframe,\n // so we have to call the onChange() event inside NgZone to force change propigation to consuming components.\n this.zone.run(() => {\n this.ViewToModelUpdate();\n });\n });\n\n this.editorService\n .selectionChangeListener(this.id)\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => {\n this.updateStyle();\n this.editorFocusStream.next();\n });\n\n this.editorService\n .clickListener(this.id)\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => {\n this.editorFocusStream.next();\n });\n\n this.editorService\n .blurListener(this.id)\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => {\n // Angular doesn't run change detection for changes originating inside an iframe,\n // so we have to run markForCheck() inside the NgZone to force change propigation to consuming components.\n this.zone.run(() => {\n this._onTouched();\n });\n });\n\n this.editorService\n .commandChangeListener(this.id)\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => {\n this.updateStyle();\n this.ViewToModelUpdate();\n });\n\n this.adapterService.setEditorInnerHtml(this.id, this._value);\n\n /* istanbul ignore next */\n if (this.autofocus) {\n this.adapterService.focusEditor(this.id);\n }\n\n this.initialized = true;\n }\n\n private ViewToModelUpdate(emitChange: boolean = true): void {\n this.value = this.adapterService.getEditorInnerHtml(this.id);\n /* istanbul ignore else */\n if (emitChange) {\n this._onChange(this._value);\n }\n }\n\n /* istanbul ignore next */\n private _onTouched = () => {};\n\n /* istanbul ignore next */\n private _onChange: (value: any) => void = () => {};\n}\n","<div class=\"sky-text-editor\">\n <sky-toolbar class=\"sky-text-editor-toolbar\">\n <sky-toolbar-section\n aria-label=\"Text formatting\"\n class=\"menubar\"\n role=\"toolbar\"\n >\n <sky-text-editor-menubar\n [disabled]=\"disabled\"\n [editorFocusStream]=\"editorFocusStream\"\n [editorId]=\"id\"\n [menus]=\"menus\"\n [mergeFields]=\"mergeFields\"\n >\n </sky-text-editor-menubar>\n </sky-toolbar-section>\n <sky-toolbar-section\n aria-label=\"Text formatting\"\n class=\"toolbar\"\n role=\"toolbar\"\n >\n <sky-text-editor-toolbar\n [disabled]=\"disabled\"\n [editorFocusStream]=\"editorFocusStream\"\n [editorId]=\"id\"\n [fontList]=\"fontList\"\n [fontSizeList]=\"fontSizeList\"\n [toolbarActions]=\"toolbarActions\"\n [styleState]=\"initialStyleState\"\n >\n </sky-text-editor-toolbar>\n </sky-toolbar-section>\n </sky-toolbar>\n <iframe\n class=\"sky-text-editor-wrapper\"\n src=\"about:blank\"\n title=\"Text Editor\"\n [ngClass]=\"{\n 'sky-text-editor-wrapper-disabled': disabled\n }\"\n (load)=\"onIframeLoad()\"\n #iframe\n >\n </iframe>\n</div>\n"]}
|
|
1
|
+
{"version":3,"file":"text-editor.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/text-editor/src/lib/modules/text-editor/text-editor.component.ts","../../../../../../../../libs/components/text-editor/src/lib/modules/text-editor/text-editor.component.html"],"names":[],"mappings":"AAAA,OAAO,EAEL,uBAAuB,EACvB,iBAAiB,EACjB,SAAS,EACT,UAAU,EACV,KAAK,EACL,MAAM,EAEN,SAAS,EACT,iBAAiB,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEpD,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;;;;;;;;;;;AAOlF;;GAEG;AACH,IAAI,YAAY,GAAG,CAAC,CAAC;AAErB;;GAEG;AAQH,MAAM,OAAO,sBAAsB;IA+LjC,YACU,cAAiC,EACjC,kBAAyC,EACzC,cAA2C,EAC3C,aAAmC,EACnC,mBAA+C,EAC/C,SAAoB,EACpB,IAAY;QANZ,mBAAc,GAAd,cAAc,CAAmB;QACjC,uBAAkB,GAAlB,kBAAkB,CAAuB;QACzC,mBAAc,GAAd,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EAAE,CAAC,8BAA8B,CAAC;oBAC3C,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,aAAa,EAAE,iBAAiB,CAAC,IAAI;iBACtC;+SAMQ,SAAS;sBADf,KAAK;gBAQK,QAAQ;sBADlB,KAAK;gBA+CC,QAAQ;sBADd,KAAK;gBAQC,YAAY;sBADlB,KAAK;gBAQC,EAAE;sBADR,KAAK;gBAOK,iBAAiB;sBAD3B,KAAK;gBAqBC,KAAK;sBADX,KAAK;gBAOC,WAAW;sBADjB,KAAK;gBAOK,WAAW;sBADrB,KAAK;gBAoBC,cAAc;sBADpB,KAAK;gBAiDE,SAAS;sBADhB,SAAS;uBAAC,QAAQ","sourcesContent":["import {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n Input,\n NgZone,\n OnDestroy,\n ViewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport { NgControl } from '@angular/forms';\nimport { SkyCoreAdapterService } from '@skyux/core';\n\nimport { Subject } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport { SkyFormsUtility } from '../shared/forms-utility';\n\nimport { FONT_LIST_DEFAULTS } from './defaults/font-list-defaults';\nimport { FONT_SIZE_LIST_DEFAULTS } from './defaults/font-size-list-defaults';\nimport { MENU_DEFAULTS } from './defaults/menu-defaults';\nimport { STYLE_STATE_DEFAULTS } from './defaults/style-state-defaults';\nimport { TOOLBAR_ACTION_DEFAULTS } from './defaults/toolbar-action-defaults';\nimport { SkyTextEditorAdapterService } from './services/text-editor-adapter.service';\nimport { SkyTextEditorService } from './services/text-editor.service';\nimport { SkyTextSanitizationService } from './services/text-sanitization.service';\nimport { SkyTextEditorFont } from './types/font-state';\nimport { SkyTextEditorMenuType } from './types/menu-type';\nimport { SkyTextEditorStyleState } from './types/style-state';\nimport { SkyTextEditorMergeField } from './types/text-editor-merge-field';\nimport { SkyTextEditorToolbarActionType } from './types/toolbar-action-type';\n\n/**\n * Auto-incrementing integer used to generate unique ids for radio components.\n */\nlet nextUniqueId = 0;\n\n/**\n * The text editor component lets users format and manipulate text.\n */\n@Component({\n selector: 'sky-text-editor',\n templateUrl: './text-editor.component.html',\n styleUrls: ['./text-editor.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n})\nexport class SkyTextEditorComponent implements AfterViewInit, OnDestroy {\n /**\n * Indicates whether to put focus on the editor after it renders.\n */\n @Input()\n public autofocus = false;\n\n /**\n * Indicates whether to disable the text editor.\n * @default false\n */\n @Input()\n public set disabled(value: boolean) {\n const coercedValue = SkyFormsUtility.coerceBooleanProperty(value);\n if (coercedValue !== this.disabled) {\n this._disabled = coercedValue;\n\n // Update focusableChildren inside the iframe.\n let focusableChildren: HTMLElement[];\n /* istanbul ignore else */\n if (this.iframeRef) {\n focusableChildren = this.coreAdapterService.getFocusableChildren(\n this.iframeRef.nativeElement.contentDocument.body,\n {\n ignoreVisibility: true,\n ignoreTabIndex: true,\n }\n );\n }\n\n if (this._disabled) {\n this.adapterService.disableEditor(\n this.id,\n focusableChildren,\n this.iframeRef.nativeElement\n );\n } else {\n this.adapterService.enableEditor(\n this.id,\n focusableChildren,\n this.iframeRef.nativeElement\n );\n }\n this.changeDetector.markForCheck();\n }\n }\n\n public get disabled() {\n return this._disabled;\n }\n\n public editorFocusStream = new Subject();\n\n /**\n * Specifies the fonts to include in the font picker.\n * @default [{name: 'Blackbaud Sans', value: '\"Blackbaud Sans\", Arial, sans-serif'}, {name: 'Arial', value: 'Arial'}, {name: 'Arial Black', value: '\"Arial Black\"'}, {name: 'Courier New', value: '\"Courier New\"'}, {name: 'Georgia', value: 'Georgia, serif'}, {name: 'Tahoma', value: 'Tahoma, Geneva, sans-serif'}, {name: 'Times New Roman', value: '\"Times New Roman\"'}, {name: 'Trebuchet MS', value: '\"Trebuchet MS\", sans-serif'}, {name: 'Verdana', value: 'Verdana, Geneva, sans-serif'}]\n */\n @Input()\n public fontList: SkyTextEditorFont[] = FONT_LIST_DEFAULTS;\n\n /**\n * Specifies the font sizes to include in the font size picker.\n * @default [6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 22, 24, 26, 28, 36, 48]\n */\n @Input()\n public fontSizeList: number[] = FONT_SIZE_LIST_DEFAULTS;\n\n /**\n * Specifies a unique ID attribute for the text editor.\n * By default, the component generates a random ID.\n */\n @Input()\n public id = `sky-text-editor-${++nextUniqueId}`;\n\n /**\n * Specifies the initial styles for all content, including background color, font size, and link state.\n */\n @Input()\n public set initialStyleState(state: SkyTextEditorStyleState) {\n // Do not update the state after initialization has taken place\n /* istanbul ignore else */\n if (!this.initialized) {\n this._initialStyleState = {\n ...STYLE_STATE_DEFAULTS,\n ...state,\n };\n }\n }\n\n public get initialStyleState(): SkyTextEditorStyleState {\n return this._initialStyleState;\n }\n\n /**\n * Specifies the menus to include in the menu bar.\n * @default [ 'edit', 'format' ]\n */\n @Input()\n public menus: SkyTextEditorMenuType[] = MENU_DEFAULTS;\n\n /**\n * Specifies the merge fields to include in the merge field menu.\n */\n @Input()\n public mergeFields: SkyTextEditorMergeField[] = [];\n\n /**\n * Specifies placeholder text to display when the text entry area is empty.\n */\n @Input()\n public set placeholder(value: string) {\n /* istanbul ignore else */\n if (value !== this._placeholder) {\n this._placeholder = value;\n if (this.initialized) {\n this.adapterService.setPlaceholder(this.id, value);\n }\n }\n }\n\n public get placeholder(): string {\n return this._placeholder;\n }\n\n /**\n * Specifies the actions to include in the toolbar and determines their order.\n * @default [ 'font-family', 'font-size', 'font-style', 'color', 'list', 'link ]\n */\n @Input()\n public toolbarActions: SkyTextEditorToolbarActionType[] = TOOLBAR_ACTION_DEFAULTS;\n\n /**\n * The internal value of the control.\n */\n public set value(value: string) {\n // Normalize value and set any empty state to an empty string.\n let normalizedValue: string = value;\n if (\n !value ||\n value.trim() === '<p></p>' ||\n value.trim() === '<br>' ||\n value.trim() === '<p><br></p>'\n ) {\n normalizedValue = '';\n }\n normalizedValue = this.sanitizationService.sanitize(normalizedValue).trim();\n\n if (this._value !== normalizedValue) {\n this._value = normalizedValue;\n\n // Update angular form control if model has been normalized.\n /* istanbul ignore else */\n if (this.ngControl && this.ngControl.control) {\n /* istanbul ignore else */\n if (normalizedValue !== this.ngControl.control.value) {\n this.ngControl.control.setValue(normalizedValue, {\n emitModelToViewChange: false,\n });\n }\n }\n\n // Autofocus isn't testable in Firefox and IE.\n /* istanbul ignore next */\n if (this.autofocus && !this.focusInitialized) {\n this.adapterService.focusEditor(this.id);\n this.focusInitialized = true;\n }\n }\n }\n\n public get value(): string {\n return this._value;\n }\n\n private focusInitialized = false;\n\n @ViewChild('iframe')\n private iframeRef: ElementRef;\n\n private initialized = false;\n\n private ngUnsubscribe = new Subject<void>();\n\n private _disabled = false;\n\n private _initialStyleState = Object.assign({}, STYLE_STATE_DEFAULTS);\n\n private _placeholder = '';\n\n private _value = '<p></p>';\n\n constructor(\n private changeDetector: ChangeDetectorRef,\n private coreAdapterService: SkyCoreAdapterService,\n private adapterService: SkyTextEditorAdapterService,\n private editorService: SkyTextEditorService,\n private sanitizationService: SkyTextSanitizationService,\n private ngControl: NgControl,\n private zone: NgZone\n ) {\n this.ngControl.valueAccessor = this;\n }\n\n public ngAfterViewInit(): void {\n this.initIframe();\n }\n\n public ngOnDestroy(): void {\n this.adapterService.removeObservers(this.editorService.editors[this.id]);\n this.editorService.removeEditor(this.id);\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n }\n\n public onIframeLoad(): void {\n // Remove editor if it already exists to cover situations where the text editor might have been moved in the DOM.\n /* istanbul ignore else */\n if (this.editorService.editors[this.id]) {\n this.editorService.removeEditor(this.id);\n this.initIframe();\n }\n }\n\n /**\n * Implemented as part of ControlValueAccessor.\n */\n public writeValue(value: string): void {\n this.value = value;\n\n // Update HTML if necessary.\n const editorValue = this.adapterService.getEditorInnerHtml(this.id);\n if (this.initialized && editorValue !== this._value) {\n this.adapterService.setEditorInnerHtml(this.id, this._value);\n }\n }\n\n /**\n * Implemented as part of ControlValueAccessor.\n */\n public registerOnChange(fn: (value: any) => void): void {\n this._onChange = fn;\n }\n\n /**\n * Implemented as part of ControlValueAccessor.\n */\n public registerOnTouched(fn: () => void): void {\n this._onTouched = fn;\n }\n\n /**\n * Implemented as part of ControlValueAccessor.\n */\n public setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n }\n\n private updateStyle(): void {\n this._initialStyleState = {\n ...this._initialStyleState,\n ...(this.adapterService.getStyleState(this.id) as any),\n };\n }\n\n private initIframe(): void {\n this.adapterService.addEditor(\n this.id,\n this.iframeRef.nativeElement,\n this.initialStyleState,\n this.placeholder\n );\n\n this.editorService\n .inputListener(this.id)\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => {\n // Angular doesn't run change detection for changes originating inside an iframe,\n // so we have to call the onChange() event inside NgZone to force change propigation to consuming components.\n this.zone.run(() => {\n this.ViewToModelUpdate();\n });\n });\n\n this.editorService\n .selectionChangeListener(this.id)\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => {\n this.updateStyle();\n this.editorFocusStream.next();\n });\n\n this.editorService\n .clickListener(this.id)\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => {\n this.editorFocusStream.next();\n });\n\n this.editorService\n .blurListener(this.id)\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => {\n // Angular doesn't run change detection for changes originating inside an iframe,\n // so we have to run markForCheck() inside the NgZone to force change propigation to consuming components.\n this.zone.run(() => {\n this._onTouched();\n });\n });\n\n this.editorService\n .commandChangeListener(this.id)\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe(() => {\n this.updateStyle();\n this.ViewToModelUpdate();\n });\n\n this.adapterService.setEditorInnerHtml(this.id, this._value);\n\n /* istanbul ignore next */\n if (this.autofocus) {\n this.adapterService.focusEditor(this.id);\n }\n\n this.initialized = true;\n }\n\n private ViewToModelUpdate(emitChange: boolean = true): void {\n this.value = this.adapterService.getEditorInnerHtml(this.id);\n /* istanbul ignore else */\n if (emitChange) {\n this._onChange(this._value);\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private _onTouched = () => {};\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private _onChange: (value: any) => void = () => {};\n}\n","<div class=\"sky-text-editor\">\n <sky-toolbar class=\"sky-text-editor-toolbar\">\n <sky-toolbar-section\n aria-label=\"Text formatting\"\n class=\"menubar\"\n role=\"toolbar\"\n >\n <sky-text-editor-menubar\n [disabled]=\"disabled\"\n [editorFocusStream]=\"editorFocusStream\"\n [editorId]=\"id\"\n [menus]=\"menus\"\n [mergeFields]=\"mergeFields\"\n >\n </sky-text-editor-menubar>\n </sky-toolbar-section>\n <sky-toolbar-section\n aria-label=\"Text formatting\"\n class=\"toolbar\"\n role=\"toolbar\"\n >\n <sky-text-editor-toolbar\n [disabled]=\"disabled\"\n [editorFocusStream]=\"editorFocusStream\"\n [editorId]=\"id\"\n [fontList]=\"fontList\"\n [fontSizeList]=\"fontSizeList\"\n [toolbarActions]=\"toolbarActions\"\n [styleState]=\"initialStyleState\"\n >\n </sky-text-editor-toolbar>\n </sky-toolbar-section>\n </sky-toolbar>\n <iframe\n class=\"sky-text-editor-wrapper\"\n src=\"about:blank\"\n title=\"Text Editor\"\n [ngClass]=\"{\n 'sky-text-editor-wrapper-disabled': disabled\n }\"\n (load)=\"onIframeLoad()\"\n #iframe\n >\n </iframe>\n</div>\n"]}
|
|
@@ -115,7 +115,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
115
115
|
/**
|
|
116
116
|
* NOTICE: DO NOT MODIFY THIS FILE!
|
|
117
117
|
* The contents of this file were automatically generated by
|
|
118
|
-
* the 'ng generate @skyux/i18n:lib-resources-module modules/shared/sky-text-editor' schematic.
|
|
118
|
+
* the 'ng generate @skyux/i18n:lib-resources-module lib/modules/shared/sky-text-editor' schematic.
|
|
119
119
|
* To update this file, simply rerun the command.
|
|
120
120
|
*/
|
|
121
121
|
const RESOURCES = {
|
|
@@ -821,7 +821,8 @@ class SkyTextEditorAdapterService {
|
|
|
821
821
|
range.deleteContents();
|
|
822
822
|
const el = documentEl.createElement('div');
|
|
823
823
|
el.innerHTML = html;
|
|
824
|
-
|
|
824
|
+
const frag = documentEl.createDocumentFragment();
|
|
825
|
+
let node, lastNode;
|
|
825
826
|
while (el.firstChild) {
|
|
826
827
|
node = el.firstChild;
|
|
827
828
|
lastNode = frag.appendChild(node);
|
|
@@ -1419,9 +1420,9 @@ class SkyTextEditorComponent {
|
|
|
1419
1420
|
this._initialStyleState = Object.assign({}, STYLE_STATE_DEFAULTS);
|
|
1420
1421
|
this._placeholder = '';
|
|
1421
1422
|
this._value = '<p></p>';
|
|
1422
|
-
|
|
1423
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1423
1424
|
this._onTouched = () => { };
|
|
1424
|
-
|
|
1425
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1425
1426
|
this._onChange = () => { };
|
|
1426
1427
|
this.ngControl.valueAccessor = this;
|
|
1427
1428
|
}
|