@skyux/text-editor 5.5.0 → 5.6.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 +30 -30
- package/documentation.json +30 -30
- package/esm2015/lib/modules/rich-text-display/rich-text-display.component.js.map +1 -1
- package/esm2015/lib/modules/rich-text-display/rich-text-display.module.js.map +1 -1
- 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/defaults/style-state-defaults.js.map +1 -1
- package/esm2015/lib/modules/text-editor/menubar/text-editor-menubar.component.js +4 -4
- package/esm2015/lib/modules/text-editor/menubar/text-editor-menubar.component.js.map +1 -1
- package/esm2015/lib/modules/text-editor/services/text-editor-adapter.service.js +4 -4
- package/esm2015/lib/modules/text-editor/services/text-editor-adapter.service.js.map +1 -1
- package/esm2015/lib/modules/text-editor/services/text-sanitization.service.js +1 -1
- package/esm2015/lib/modules/text-editor/services/text-sanitization.service.js.map +1 -1
- package/esm2015/lib/modules/text-editor/text-editor.component.js +6 -6
- package/esm2015/lib/modules/text-editor/text-editor.component.js.map +1 -1
- package/esm2015/lib/modules/text-editor/text-editor.module.js +3 -3
- package/esm2015/lib/modules/text-editor/text-editor.module.js.map +1 -1
- package/esm2015/lib/modules/text-editor/toolbar/text-editor-toolbar.component.js +4 -4
- package/esm2015/lib/modules/text-editor/toolbar/text-editor-toolbar.component.js.map +1 -1
- package/esm2015/lib/modules/text-editor/url-modal/text-editor-url-modal.component.js.map +1 -1
- package/fesm2015/skyux-text-editor.js +101 -101
- package/fesm2015/skyux-text-editor.js.map +1 -1
- package/lib/modules/text-editor/services/text-editor-adapter.service.d.ts +1 -1
- package/lib/modules/text-editor/text-editor.component.d.ts +1 -1
- package/lib/modules/text-editor/toolbar/text-editor-toolbar.component.d.ts +2 -2
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-editor-url-modal.component.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/text-editor/src/lib/modules/text-editor/url-modal/text-editor-url-modal.component.ts","../../../../../../../../../libs/components/text-editor/src/lib/modules/text-editor/url-modal/text-editor-url-modal.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAIlD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;;;;;;;;;AAErD,MAAM,QAAQ,GAAG,SAAS,CAAC;AAC3B,MAAM,mBAAmB,GAAG,WAAW,CAAC;AAExC;;GAEG;AAMH,MAAM,OAAO,8BAA8B;IAsCzC,YACmB,aAA+B,EAChD,YAAgC;QADf,kBAAa,GAAb,aAAa,CAAkB;QAf3C,sBAAiB,GAAY,KAAK,CAAC;QAEnC,YAAO,GAAW,EAAE,CAAC;QAErB,WAAM,GAAW,CAAC,CAAC;QAEnB,UAAK,GAAY,KAAK,CAAC;QAEvB,eAAU,GAAG,CAAC,CAAC;QAEd,kBAAa,GAAW,EAAE,CAAC;QAE3B,SAAI,GAAW,UAAU,CAAC;QAMhC,IAAI,YAAY,CAAC,SAAS,EAAE;YAC1B,IAAI,YAAY,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;gBACnD,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;gBAErE,IAAI,gBAAgB,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;gBACtE,gBAAgB;oBACd,gBAAgB,GAAG,CAAC,CAAC;wBACnB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IAAI,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACzE,CAAC;;4HAhHU,8BAA8B;gHAA9B,8BAA8B,iECvB3C,+xGAmGA;4FD5Ea,8BAA8B;kBAL1C,SAAS;mBAAC;oBACT,QAAQ,EAAE,2BAA2B;oBACrC,WAAW,EAAE,wCAAwC;oBACrD,SAAS,EAAE,CAAC,wCAAwC,CAAC;iBACtD","sourcesContent":["import { Component } from '@angular/core';\n\nimport { SkyModalInstance } from '@skyux/modals';\n\nimport { SkyValidation } from '@skyux/validation';\n\nimport { UrlModalResult } from './text-editor-url-modal-result';\n\nimport { SkyUrlModalContext } from './text-editor-url-modal-context';\n\nimport { UrlTarget } from './text-editor-url-target';\n\nconst emailKey = 'mailto:';\nconst queryStringParamKey = '?Subject=';\n\n/**\n * @internal\n */\n@Component({\n selector: 'sky-text-editor-url-modal',\n templateUrl: './text-editor-url-modal.component.html',\n styleUrls: ['./text-editor-url-modal.component.scss'],\n})\nexport class SkyTextEditorUrlModalComponent {\n public set activeTab(value: number) {\n this._activeTab = value;\n this.valid = this.isValid();\n }\n public get activeTab(): number {\n return this._activeTab;\n }\n public set emailAddress(value: string) {\n this._emailAddress = value;\n this.valid = this.isValid();\n }\n public get emailAddress(): string {\n return this._emailAddress;\n }\n\n public set url(value: string) {\n this._url = value;\n this.valid = this.isValid();\n }\n public get url(): string {\n return this._url;\n }\n\n public emailAddressValid: boolean = false;\n\n public subject: string = '';\n\n public target: number = 0;\n\n public valid: boolean = false;\n\n public _activeTab = 0;\n\n private _emailAddress: string = '';\n\n private _url: string = 'https://';\n\n constructor(\n private readonly modalInstance: SkyModalInstance,\n modalContext: SkyUrlModalContext\n ) {\n if (modalContext.urlResult) {\n if (modalContext.urlResult.url.startsWith(emailKey)) {\n this.emailAddress = modalContext.urlResult.url.replace(emailKey, '');\n\n let queryStringIndex = this.emailAddress.indexOf(queryStringParamKey);\n queryStringIndex =\n queryStringIndex > -1\n ? queryStringIndex\n : this.emailAddress.indexOf(queryStringParamKey.toLowerCase());\n\n /* istanbul ignore else */\n if (queryStringIndex > -1) {\n this.subject = decodeURI(this.emailAddress).slice(\n queryStringIndex + queryStringParamKey.length\n );\n this.emailAddress = this.emailAddress.slice(0, queryStringIndex);\n }\n\n // Set active tab to email\n this.activeTab = 1;\n } else {\n (this.url = modalContext.urlResult.url),\n (this.target = modalContext.urlResult.target as any);\n\n // set active tab to web page\n this.activeTab = 0;\n }\n }\n }\n\n public activeTabChanged(value: number): void {\n this.activeTab = value;\n }\n\n public save(): void {\n /* istanbul ignore else */\n if (this.isValid()) {\n if (this.activeTab === 0) {\n this.modalInstance.save({\n url: this.url,\n target: this.target\n ? parseInt(this.target as any, undefined)\n : UrlTarget.None,\n } as UrlModalResult);\n } else {\n this.modalInstance.save({\n url: this.getEmailUrl(),\n target: UrlTarget.None,\n } as UrlModalResult);\n }\n }\n }\n\n public cancel(): void {\n this.modalInstance.cancel();\n }\n\n private getEmailUrl(): string {\n return (\n emailKey +\n this.emailAddress +\n (this.subject ? '?Subject=' + encodeURI(this.subject) : '')\n );\n }\n\n private isValid(): boolean {\n if (this.activeTab === 0) {\n return !!this.url && SkyValidation.isUrl(this.url);\n }\n return !!this.emailAddress && SkyValidation.isEmail(this.emailAddress);\n }\n}\n","<sky-modal>\n <sky-modal-header>\n {{ 'skyux_text_editor_url_modal_header_label' | skyLibResources }}\n </sky-modal-header>\n <sky-modal-content>\n <sky-tabset\n data-sky-id=\"test-tabset\"\n [active]=\"activeTab\"\n (activeChange)=\"activeTabChanged($event)\"\n >\n <sky-tab tabHeading=\"Web page\">\n <div class=\"sky-form-group sky-text-editor-url-modal-first-field\">\n <sky-input-box>\n <label\n class=\"sky-control-label sky-control-label-required\"\n [for]=\"urlInput.id\"\n >\n {{ 'skyux_text_editor_url_modal_url_label' | skyLibResources }}\n </label>\n <input\n class=\"sky-form-control\"\n type=\"text\"\n [(ngModel)]=\"url\"\n skyId\n #urlInput=\"skyId\"\n />\n </sky-input-box>\n </div>\n <sky-input-box class=\"sky-form-group\">\n <label class=\"sky-control-label\" [for]=\"targetInput.id\">\n {{ 'skyux_text_editor_url_modal_open_label' | skyLibResources }}\n </label>\n <select\n class=\"sky-form-control\"\n [(ngModel)]=\"target\"\n skyId\n #targetInput=\"skyId\"\n >\n <option value=\"0\">\n {{\n 'skyux_text_editor_url_modal_current_option_label'\n | skyLibResources\n }}\n </option>\n <option value=\"1\">\n {{\n 'skyux_text_editor_url_modal_new_option_label' | skyLibResources\n }}\n </option>\n </select>\n </sky-input-box>\n </sky-tab>\n <sky-tab tabHeading=\"Email address\">\n <div class=\"sky-form-group first-field\">\n <sky-input-box>\n <label\n class=\"sky-control-label sky-control-label-required\"\n [for]=\"emailAddressInput.id\"\n >\n {{ 'skyux_text_editor_url_modal_email_label' | skyLibResources }}\n </label>\n <input\n class=\"sky-form-control\"\n type=\"text\"\n [(ngModel)]=\"emailAddress\"\n skyId\n #emailAddressInput=\"skyId\"\n />\n </sky-input-box>\n </div>\n <sky-input-box class=\"sky-form-group\">\n <label class=\"sky-control-label\" [for]=\"subjectInput.id\">\n {{ 'skyux_text_editor_url_modal_subject_label' | skyLibResources }}\n </label>\n <input\n class=\"sky-form-control\"\n type=\"text\"\n [(ngModel)]=\"subject\"\n skyId\n #subjectInput=\"skyId\"\n />\n </sky-input-box>\n </sky-tab>\n </sky-tabset>\n </sky-modal-content>\n <sky-modal-footer>\n <button\n type=\"submit\"\n class=\"sky-btn sky-btn-primary\"\n [disabled]=\"!valid\"\n (click)=\"save()\"\n >\n {{ 'skyux_text_editor_url_modal_save_button_label' | skyLibResources }}\n </button>\n <button type=\"button\" class=\"sky-btn sky-btn-link\" (click)=\"cancel()\">\n {{ 'skyux_text_editor_url_modal_cancel_button_label' | skyLibResources }}\n </button>\n </sky-modal-footer>\n</sky-modal>\n"]}
|
|
1
|
+
{"version":3,"file":"text-editor-url-modal.component.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/text-editor/src/lib/modules/text-editor/url-modal/text-editor-url-modal.component.ts","../../../../../../../../../libs/components/text-editor/src/lib/modules/text-editor/url-modal/text-editor-url-modal.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;;;;;;;;;AAErD,MAAM,QAAQ,GAAG,SAAS,CAAC;AAC3B,MAAM,mBAAmB,GAAG,WAAW,CAAC;AAExC;;GAEG;AAMH,MAAM,OAAO,8BAA8B;IAsCzC,YACmB,aAA+B,EAChD,YAAgC;QADf,kBAAa,GAAb,aAAa,CAAkB;QAf3C,sBAAiB,GAAG,KAAK,CAAC;QAE1B,YAAO,GAAG,EAAE,CAAC;QAEb,WAAM,GAAG,CAAC,CAAC;QAEX,UAAK,GAAG,KAAK,CAAC;QAEd,eAAU,GAAG,CAAC,CAAC;QAEd,kBAAa,GAAG,EAAE,CAAC;QAEnB,SAAI,GAAG,UAAU,CAAC;QAMxB,IAAI,YAAY,CAAC,SAAS,EAAE;YAC1B,IAAI,YAAY,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;gBACnD,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;gBAErE,IAAI,gBAAgB,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;gBACtE,gBAAgB;oBACd,gBAAgB,GAAG,CAAC,CAAC;wBACnB,CAAC,CAAC,gBAAgB;wBAClB,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,mBAAmB,CAAC,WAAW,EA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BAA8B,iECnB3C,+xGAmGA;4FDhFa,8BAA8B;kBAL1C,SAAS;mBAAC;oBACT,QAAQ,EAAE,2BAA2B;oBACrC,WAAW,EAAE,wCAAwC;oBACrD,SAAS,EAAE,CAAC,wCAAwC,CAAC;iBACtD","sourcesContent":["import { Component } from '@angular/core';\nimport { SkyModalInstance } from '@skyux/modals';\nimport { SkyValidation } from '@skyux/validation';\n\nimport { SkyUrlModalContext } from './text-editor-url-modal-context';\nimport { UrlModalResult } from './text-editor-url-modal-result';\nimport { UrlTarget } from './text-editor-url-target';\n\nconst emailKey = 'mailto:';\nconst queryStringParamKey = '?Subject=';\n\n/**\n * @internal\n */\n@Component({\n selector: 'sky-text-editor-url-modal',\n templateUrl: './text-editor-url-modal.component.html',\n styleUrls: ['./text-editor-url-modal.component.scss'],\n})\nexport class SkyTextEditorUrlModalComponent {\n public set activeTab(value: number) {\n this._activeTab = value;\n this.valid = this.isValid();\n }\n public get activeTab(): number {\n return this._activeTab;\n }\n public set emailAddress(value: string) {\n this._emailAddress = value;\n this.valid = this.isValid();\n }\n public get emailAddress(): string {\n return this._emailAddress;\n }\n\n public set url(value: string) {\n this._url = value;\n this.valid = this.isValid();\n }\n public get url(): string {\n return this._url;\n }\n\n public emailAddressValid = false;\n\n public subject = '';\n\n public target = 0;\n\n public valid = false;\n\n public _activeTab = 0;\n\n private _emailAddress = '';\n\n private _url = 'https://';\n\n constructor(\n private readonly modalInstance: SkyModalInstance,\n modalContext: SkyUrlModalContext\n ) {\n if (modalContext.urlResult) {\n if (modalContext.urlResult.url.startsWith(emailKey)) {\n this.emailAddress = modalContext.urlResult.url.replace(emailKey, '');\n\n let queryStringIndex = this.emailAddress.indexOf(queryStringParamKey);\n queryStringIndex =\n queryStringIndex > -1\n ? queryStringIndex\n : this.emailAddress.indexOf(queryStringParamKey.toLowerCase());\n\n /* istanbul ignore else */\n if (queryStringIndex > -1) {\n this.subject = decodeURI(this.emailAddress).slice(\n queryStringIndex + queryStringParamKey.length\n );\n this.emailAddress = this.emailAddress.slice(0, queryStringIndex);\n }\n\n // Set active tab to email\n this.activeTab = 1;\n } else {\n (this.url = modalContext.urlResult.url),\n (this.target = modalContext.urlResult.target as any);\n\n // set active tab to web page\n this.activeTab = 0;\n }\n }\n }\n\n public activeTabChanged(value: number): void {\n this.activeTab = value;\n }\n\n public save(): void {\n /* istanbul ignore else */\n if (this.isValid()) {\n if (this.activeTab === 0) {\n this.modalInstance.save({\n url: this.url,\n target: this.target\n ? parseInt(this.target as any, undefined)\n : UrlTarget.None,\n } as UrlModalResult);\n } else {\n this.modalInstance.save({\n url: this.getEmailUrl(),\n target: UrlTarget.None,\n } as UrlModalResult);\n }\n }\n }\n\n public cancel(): void {\n this.modalInstance.cancel();\n }\n\n private getEmailUrl(): string {\n return (\n emailKey +\n this.emailAddress +\n (this.subject ? '?Subject=' + encodeURI(this.subject) : '')\n );\n }\n\n private isValid(): boolean {\n if (this.activeTab === 0) {\n return !!this.url && SkyValidation.isUrl(this.url);\n }\n return !!this.emailAddress && SkyValidation.isEmail(this.emailAddress);\n }\n}\n","<sky-modal>\n <sky-modal-header>\n {{ 'skyux_text_editor_url_modal_header_label' | skyLibResources }}\n </sky-modal-header>\n <sky-modal-content>\n <sky-tabset\n data-sky-id=\"test-tabset\"\n [active]=\"activeTab\"\n (activeChange)=\"activeTabChanged($event)\"\n >\n <sky-tab tabHeading=\"Web page\">\n <div class=\"sky-form-group sky-text-editor-url-modal-first-field\">\n <sky-input-box>\n <label\n class=\"sky-control-label sky-control-label-required\"\n [for]=\"urlInput.id\"\n >\n {{ 'skyux_text_editor_url_modal_url_label' | skyLibResources }}\n </label>\n <input\n class=\"sky-form-control\"\n type=\"text\"\n [(ngModel)]=\"url\"\n skyId\n #urlInput=\"skyId\"\n />\n </sky-input-box>\n </div>\n <sky-input-box class=\"sky-form-group\">\n <label class=\"sky-control-label\" [for]=\"targetInput.id\">\n {{ 'skyux_text_editor_url_modal_open_label' | skyLibResources }}\n </label>\n <select\n class=\"sky-form-control\"\n [(ngModel)]=\"target\"\n skyId\n #targetInput=\"skyId\"\n >\n <option value=\"0\">\n {{\n 'skyux_text_editor_url_modal_current_option_label'\n | skyLibResources\n }}\n </option>\n <option value=\"1\">\n {{\n 'skyux_text_editor_url_modal_new_option_label' | skyLibResources\n }}\n </option>\n </select>\n </sky-input-box>\n </sky-tab>\n <sky-tab tabHeading=\"Email address\">\n <div class=\"sky-form-group first-field\">\n <sky-input-box>\n <label\n class=\"sky-control-label sky-control-label-required\"\n [for]=\"emailAddressInput.id\"\n >\n {{ 'skyux_text_editor_url_modal_email_label' | skyLibResources }}\n </label>\n <input\n class=\"sky-form-control\"\n type=\"text\"\n [(ngModel)]=\"emailAddress\"\n skyId\n #emailAddressInput=\"skyId\"\n />\n </sky-input-box>\n </div>\n <sky-input-box class=\"sky-form-group\">\n <label class=\"sky-control-label\" [for]=\"subjectInput.id\">\n {{ 'skyux_text_editor_url_modal_subject_label' | skyLibResources }}\n </label>\n <input\n class=\"sky-form-control\"\n type=\"text\"\n [(ngModel)]=\"subject\"\n skyId\n #subjectInput=\"skyId\"\n />\n </sky-input-box>\n </sky-tab>\n </sky-tabset>\n </sky-modal-content>\n <sky-modal-footer>\n <button\n type=\"submit\"\n class=\"sky-btn sky-btn-primary\"\n [disabled]=\"!valid\"\n (click)=\"save()\"\n >\n {{ 'skyux_text_editor_url_modal_save_button_label' | skyLibResources }}\n </button>\n <button type=\"button\" class=\"sky-btn sky-btn-link\" (click)=\"cancel()\">\n {{ 'skyux_text_editor_url_modal_cancel_button_label' | skyLibResources }}\n </button>\n </sky-modal-footer>\n</sky-modal>\n"]}
|
|
@@ -12,14 +12,14 @@ import * as i3 from '@skyux/core';
|
|
|
12
12
|
import { SkyCoreAdapterModule, SkyIdModule } from '@skyux/core';
|
|
13
13
|
import * as i4$1 from '@skyux/forms';
|
|
14
14
|
import { SkyInputBoxModule, SkyCheckboxModule } from '@skyux/forms';
|
|
15
|
-
import * as i1$1 from '@skyux/modals';
|
|
16
|
-
import { SkyModalModule } from '@skyux/modals';
|
|
17
15
|
import * as i2 from '@skyux/i18n';
|
|
18
16
|
import { getLibStringForLocale, SkyI18nModule, SKY_LIB_RESOURCES_PROVIDERS } from '@skyux/i18n';
|
|
19
17
|
import * as i7 from '@skyux/indicators';
|
|
20
18
|
import { SkyIconModule } from '@skyux/indicators';
|
|
21
19
|
import * as i3$1 from '@skyux/layout';
|
|
22
20
|
import { SkyToolbarModule } from '@skyux/layout';
|
|
21
|
+
import * as i1$1 from '@skyux/modals';
|
|
22
|
+
import { SkyModalModule } from '@skyux/modals';
|
|
23
23
|
import * as i4 from '@skyux/popovers';
|
|
24
24
|
import { SkyDropdownMessageType, SkyDropdownModule } from '@skyux/popovers';
|
|
25
25
|
import * as i3$2 from '@skyux/tabs';
|
|
@@ -34,7 +34,7 @@ const domPurify = createDOMPurify(window);
|
|
|
34
34
|
domPurify.addHook('afterSanitizeAttributes', (node) => {
|
|
35
35
|
// Set all elements owning target to target=_blank
|
|
36
36
|
// so we only allow the target attribute with that value.
|
|
37
|
-
if (
|
|
37
|
+
if (node.getAttribute('target')) {
|
|
38
38
|
node.setAttribute('target', '_blank');
|
|
39
39
|
node.setAttribute('rel', 'noopener noreferrer');
|
|
40
40
|
}
|
|
@@ -215,6 +215,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
215
215
|
}]
|
|
216
216
|
}] });
|
|
217
217
|
|
|
218
|
+
// Need to add the following to classes which contain static methods.
|
|
219
|
+
// See: https://github.com/ng-packagr/ng-packagr/issues/641
|
|
220
|
+
// @dynamic
|
|
221
|
+
class SkyFormsUtility {
|
|
222
|
+
/** Coerces a data-bound value (typically a string) to a boolean. */
|
|
223
|
+
static coerceBooleanProperty(value) {
|
|
224
|
+
return value !== undefined && `${value}` !== 'false';
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
218
228
|
/**
|
|
219
229
|
* @internal
|
|
220
230
|
*/
|
|
@@ -280,65 +290,6 @@ var UrlTarget;
|
|
|
280
290
|
UrlTarget[UrlTarget["NewWindow"] = 1] = "NewWindow";
|
|
281
291
|
})(UrlTarget || (UrlTarget = {}));
|
|
282
292
|
|
|
283
|
-
/**
|
|
284
|
-
* @internal
|
|
285
|
-
*/
|
|
286
|
-
class SkyTextEditorService {
|
|
287
|
-
constructor() {
|
|
288
|
-
/**
|
|
289
|
-
* A dictionary representing all active text editors and their settings.
|
|
290
|
-
*/
|
|
291
|
-
this.editors = {};
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
* Returns the blur observable from the editor with the corresponding id.
|
|
295
|
-
*/
|
|
296
|
-
blurListener(id) {
|
|
297
|
-
return this.editors[id].blurObservable;
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
|
-
* Returns the click observable from the editor with the corresponding id.
|
|
301
|
-
*/
|
|
302
|
-
clickListener(id) {
|
|
303
|
-
return this.editors[id].clickObservable;
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* Returns the command change observable from the editor with the corresponding id.
|
|
307
|
-
*/
|
|
308
|
-
commandChangeListener(id) {
|
|
309
|
-
return this.editors[id].commandChangeObservable;
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* Returns the input change observable from the editor with the corresponding id.
|
|
313
|
-
*/
|
|
314
|
-
inputListener(id) {
|
|
315
|
-
return this.editors[id].inputObservable;
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* Removes editor from the `editors` index by id.
|
|
319
|
-
*/
|
|
320
|
-
removeEditor(id) {
|
|
321
|
-
/* istanbul ignore else */
|
|
322
|
-
if (id in this.editors) {
|
|
323
|
-
delete this.editors[id];
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
/**
|
|
327
|
-
* Returns the selection change observable from the editor with the corresponding id.
|
|
328
|
-
*/
|
|
329
|
-
selectionChangeListener(id) {
|
|
330
|
-
return this.editors[id].selectionChangeObservable;
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
SkyTextEditorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyTextEditorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
334
|
-
SkyTextEditorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyTextEditorService, providedIn: 'root' });
|
|
335
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyTextEditorService, decorators: [{
|
|
336
|
-
type: Injectable,
|
|
337
|
-
args: [{
|
|
338
|
-
providedIn: 'root',
|
|
339
|
-
}]
|
|
340
|
-
}] });
|
|
341
|
-
|
|
342
293
|
/**
|
|
343
294
|
* @internal
|
|
344
295
|
*/
|
|
@@ -417,6 +368,65 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
417
368
|
}]
|
|
418
369
|
}] });
|
|
419
370
|
|
|
371
|
+
/**
|
|
372
|
+
* @internal
|
|
373
|
+
*/
|
|
374
|
+
class SkyTextEditorService {
|
|
375
|
+
constructor() {
|
|
376
|
+
/**
|
|
377
|
+
* A dictionary representing all active text editors and their settings.
|
|
378
|
+
*/
|
|
379
|
+
this.editors = {};
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Returns the blur observable from the editor with the corresponding id.
|
|
383
|
+
*/
|
|
384
|
+
blurListener(id) {
|
|
385
|
+
return this.editors[id].blurObservable;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Returns the click observable from the editor with the corresponding id.
|
|
389
|
+
*/
|
|
390
|
+
clickListener(id) {
|
|
391
|
+
return this.editors[id].clickObservable;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Returns the command change observable from the editor with the corresponding id.
|
|
395
|
+
*/
|
|
396
|
+
commandChangeListener(id) {
|
|
397
|
+
return this.editors[id].commandChangeObservable;
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Returns the input change observable from the editor with the corresponding id.
|
|
401
|
+
*/
|
|
402
|
+
inputListener(id) {
|
|
403
|
+
return this.editors[id].inputObservable;
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Removes editor from the `editors` index by id.
|
|
407
|
+
*/
|
|
408
|
+
removeEditor(id) {
|
|
409
|
+
/* istanbul ignore else */
|
|
410
|
+
if (id in this.editors) {
|
|
411
|
+
delete this.editors[id];
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Returns the selection change observable from the editor with the corresponding id.
|
|
416
|
+
*/
|
|
417
|
+
selectionChangeListener(id) {
|
|
418
|
+
return this.editors[id].selectionChangeObservable;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
SkyTextEditorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyTextEditorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
422
|
+
SkyTextEditorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyTextEditorService, providedIn: 'root' });
|
|
423
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyTextEditorService, decorators: [{
|
|
424
|
+
type: Injectable,
|
|
425
|
+
args: [{
|
|
426
|
+
providedIn: 'root',
|
|
427
|
+
}]
|
|
428
|
+
}] });
|
|
429
|
+
|
|
420
430
|
/**
|
|
421
431
|
* @internal
|
|
422
432
|
*/
|
|
@@ -624,7 +634,7 @@ class SkyTextEditorAdapterService {
|
|
|
624
634
|
const doc = this.getIframeDocumentEl(id);
|
|
625
635
|
this.execCommand(id, { command: 'fontSize', value: 1 });
|
|
626
636
|
const fontElements = Array.from(doc.querySelectorAll('font[size="1"]'));
|
|
627
|
-
for (
|
|
637
|
+
for (const element of fontElements) {
|
|
628
638
|
element.removeAttribute('size');
|
|
629
639
|
element.style.fontSize = fontSize + 'px';
|
|
630
640
|
}
|
|
@@ -829,7 +839,7 @@ class SkyTextEditorAdapterService {
|
|
|
829
839
|
}
|
|
830
840
|
cleanUpBlankStyleTags(doc) {
|
|
831
841
|
const orphanElements = Array.from(doc.querySelectorAll('font,span,*[style=""]'));
|
|
832
|
-
for (
|
|
842
|
+
for (const element of orphanElements) {
|
|
833
843
|
if (!element.getAttribute('style')) {
|
|
834
844
|
element.removeAttribute('style');
|
|
835
845
|
}
|
|
@@ -839,7 +849,7 @@ class SkyTextEditorAdapterService {
|
|
|
839
849
|
return ((tagName === 'FONT' || tagName === 'SPAN') &&
|
|
840
850
|
(element.attributes.length === 0 || !element.hasChildNodes));
|
|
841
851
|
});
|
|
842
|
-
for (
|
|
852
|
+
for (const element of removableElements) {
|
|
843
853
|
const parent = element.parentNode;
|
|
844
854
|
/* istanbul ignore else */
|
|
845
855
|
if (parent) {
|
|
@@ -879,16 +889,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
879
889
|
}]
|
|
880
890
|
}], ctorParameters: function () { return [{ type: SkyTextEditorSelectionService }, { type: SkyTextEditorService }, { type: i3.SkyAppWindowRef }]; } });
|
|
881
891
|
|
|
882
|
-
// Need to add the following to classes which contain static methods.
|
|
883
|
-
// See: https://github.com/ng-packagr/ng-packagr/issues/641
|
|
884
|
-
// @dynamic
|
|
885
|
-
class SkyFormsUtility {
|
|
886
|
-
/** Coerces a data-bound value (typically a string) to a boolean. */
|
|
887
|
-
static coerceBooleanProperty(value) {
|
|
888
|
-
return value !== undefined && `${value}` !== 'false';
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
|
|
892
892
|
/**
|
|
893
893
|
* @internal
|
|
894
894
|
*/
|
|
@@ -1040,7 +1040,7 @@ class SkyTextEditorMenubarComponent {
|
|
|
1040
1040
|
this.mergeFieldDropdownStream.next({ type: SkyDropdownMessageType.Close });
|
|
1041
1041
|
}
|
|
1042
1042
|
clearFormat() {
|
|
1043
|
-
|
|
1043
|
+
const currentSelection = this.adapterService.getCurrentSelection(this.editorId);
|
|
1044
1044
|
/* istanbul ignore else */
|
|
1045
1045
|
if (currentSelection.rangeCount > 0 &&
|
|
1046
1046
|
currentSelection.getRangeAt(0).toString().length <= 0) {
|
|
@@ -1071,6 +1071,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1071
1071
|
type: Input
|
|
1072
1072
|
}] } });
|
|
1073
1073
|
|
|
1074
|
+
/**
|
|
1075
|
+
* @internal
|
|
1076
|
+
*/
|
|
1077
|
+
const FONT_SIZE_LIST_DEFAULTS = [
|
|
1078
|
+
6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 22, 24, 26, 28, 36, 48,
|
|
1079
|
+
];
|
|
1080
|
+
|
|
1081
|
+
/**
|
|
1082
|
+
* @internal
|
|
1083
|
+
*/
|
|
1084
|
+
const MENU_DEFAULTS = ['edit', 'format'];
|
|
1085
|
+
|
|
1086
|
+
/**
|
|
1087
|
+
* @internal
|
|
1088
|
+
*/
|
|
1089
|
+
const TOOLBAR_ACTION_DEFAULTS = [
|
|
1090
|
+
'font-family',
|
|
1091
|
+
'font-size',
|
|
1092
|
+
'font-style',
|
|
1093
|
+
'color',
|
|
1094
|
+
'list',
|
|
1095
|
+
'link',
|
|
1096
|
+
];
|
|
1097
|
+
|
|
1074
1098
|
/**
|
|
1075
1099
|
* @internal
|
|
1076
1100
|
*/
|
|
@@ -1279,7 +1303,7 @@ class SkyTextEditorToolbarComponent {
|
|
|
1279
1303
|
});
|
|
1280
1304
|
}
|
|
1281
1305
|
unlink() {
|
|
1282
|
-
|
|
1306
|
+
const currentSelectionRange = this.adapterService
|
|
1283
1307
|
.getCurrentSelection(this.editorId)
|
|
1284
1308
|
.getRangeAt(0);
|
|
1285
1309
|
if (currentSelectionRange.toString().length <= 0) {
|
|
@@ -1338,30 +1362,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1338
1362
|
type: Input
|
|
1339
1363
|
}] } });
|
|
1340
1364
|
|
|
1341
|
-
/**
|
|
1342
|
-
* @internal
|
|
1343
|
-
*/
|
|
1344
|
-
const MENU_DEFAULTS = ['edit', 'format'];
|
|
1345
|
-
|
|
1346
|
-
/**
|
|
1347
|
-
* @internal
|
|
1348
|
-
*/
|
|
1349
|
-
const TOOLBAR_ACTION_DEFAULTS = [
|
|
1350
|
-
'font-family',
|
|
1351
|
-
'font-size',
|
|
1352
|
-
'font-style',
|
|
1353
|
-
'color',
|
|
1354
|
-
'list',
|
|
1355
|
-
'link',
|
|
1356
|
-
];
|
|
1357
|
-
|
|
1358
|
-
/**
|
|
1359
|
-
* @internal
|
|
1360
|
-
*/
|
|
1361
|
-
const FONT_SIZE_LIST_DEFAULTS = [
|
|
1362
|
-
6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 22, 24, 26, 28, 36, 48,
|
|
1363
|
-
];
|
|
1364
|
-
|
|
1365
1365
|
/**
|
|
1366
1366
|
* Auto-incrementing integer used to generate unique ids for radio components.
|
|
1367
1367
|
*/
|