@skyux/text-editor 12.0.0-alpha.2 → 12.0.0-alpha.3

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.
@@ -107,6 +107,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
107
107
  type: Input
108
108
  }] } });
109
109
 
110
+ /**
111
+ * @docsIncludeIds SkyRichTextDisplayComponent
112
+ */
110
113
  class SkyRichTextDisplayModule {
111
114
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: SkyRichTextDisplayModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
112
115
  static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.5", ngImport: i0, type: SkyRichTextDisplayModule, declarations: [SkyRichTextDisplayComponent], exports: [SkyRichTextDisplayComponent] }); }
@@ -459,6 +462,9 @@ class SkyTextEditorAdapterService {
459
462
  initEditor(id, iframeElement, styleState, placeholder) {
460
463
  this.#textEditorService.editor = this.#createObservers(iframeElement);
461
464
  const documentEl = this.#getIframeDocumentEl();
465
+ if (!documentEl) {
466
+ return;
467
+ }
462
468
  const styleEl = documentEl.createElement('style');
463
469
  styleEl.innerHTML = `.editor:empty:before {
464
470
  content: attr(data-placeholder);
@@ -510,7 +516,7 @@ class SkyTextEditorAdapterService {
510
516
  await navigator.clipboard.readText().then((clipText) => {
511
517
  /* istanbul ignore else */
512
518
  if (this.editorSelected()) {
513
- documentEl.execCommand('insertHTML', false, clipText);
519
+ documentEl?.execCommand('insertHTML', false, clipText);
514
520
  this.focusEditor();
515
521
  this.#textEditorService.editor.commandChangeObservable.next();
516
522
  }
@@ -520,7 +526,7 @@ class SkyTextEditorAdapterService {
520
526
  else {
521
527
  /* istanbul ignore else */
522
528
  if (this.editorSelected()) {
523
- documentEl.execCommand(editorCommand.command, false, editorCommand.value);
529
+ documentEl?.execCommand(editorCommand.command, false, editorCommand.value);
524
530
  this.focusEditor();
525
531
  this.#textEditorService.editor.commandChangeObservable.next();
526
532
  }
@@ -528,7 +534,11 @@ class SkyTextEditorAdapterService {
528
534
  }
529
535
  }
530
536
  getCurrentSelection() {
531
- return this.#selectionService.getCurrentSelection(this.#getIframeDocumentEl());
537
+ const documentEl = this.#getIframeDocumentEl();
538
+ if (documentEl) {
539
+ return this.#selectionService.getCurrentSelection(documentEl);
540
+ }
541
+ return null;
532
542
  }
533
543
  /**
534
544
  * Returns a data URI using the provided text string.
@@ -563,7 +573,7 @@ class SkyTextEditorAdapterService {
563
573
  getStyleState() {
564
574
  const documentEl = this.#getIframeDocumentEl();
565
575
  /* istanbul ignore else */
566
- if (this.editorSelected()) {
576
+ if (documentEl && this.editorSelected()) {
567
577
  return {
568
578
  backColor: this.#getColor(documentEl, 'BackColor'),
569
579
  fontColor: this.#getColor(documentEl, 'ForeColor'),
@@ -587,9 +597,9 @@ class SkyTextEditorAdapterService {
587
597
  }
588
598
  setEditorInnerHtml(value) {
589
599
  const documentEl = this.#getIframeDocumentEl();
590
- const editorContent = documentEl.body;
600
+ const editorContent = documentEl?.body;
591
601
  /* istanbul ignore else */
592
- if (editorContent.innerHTML !== value) {
602
+ if (editorContent && editorContent.innerHTML !== value) {
593
603
  editorContent.innerHTML = value;
594
604
  }
595
605
  }
@@ -598,29 +608,31 @@ class SkyTextEditorAdapterService {
598
608
  if (this.#textEditorService.editor) {
599
609
  const windowEl = this.#getContentWindowEl();
600
610
  const iframeDocumentEl = this.#getIframeDocumentEl();
601
- const currentSelection = this.#selectionService.getCurrentSelectionRange(iframeDocumentEl, windowEl);
602
- const cursorIsNotActiveAndHasReset = currentSelection &&
603
- currentSelection.startOffset === 0 &&
604
- currentSelection.endOffset === 0;
605
- if (!this.editorSelected() || cursorIsNotActiveAndHasReset) {
606
- // focus the end of the editor
607
- const documentEl = this.#windowRef.nativeWindow.document;
608
- const editor = iframeDocumentEl.body;
609
- const range = documentEl.createRange();
610
- this.#textEditorService.editor.iframeElementRef.focus();
611
- editor.focus();
612
- if (windowEl.getSelection && documentEl.createRange) {
613
- range.selectNodeContents(editor);
614
- range.collapse(false);
615
- const sel = windowEl.getSelection();
616
- sel?.removeAllRanges();
617
- sel?.addRange(range);
611
+ if (windowEl && iframeDocumentEl) {
612
+ const currentSelection = this.#selectionService.getCurrentSelectionRange(iframeDocumentEl, windowEl);
613
+ const cursorIsNotActiveAndHasReset = currentSelection &&
614
+ currentSelection.startOffset === 0 &&
615
+ currentSelection.endOffset === 0;
616
+ if (!this.editorSelected() || cursorIsNotActiveAndHasReset) {
617
+ // focus the end of the editor
618
+ const documentEl = this.#windowRef.nativeWindow.document;
619
+ const editor = iframeDocumentEl.body;
620
+ const range = documentEl.createRange();
621
+ this.#textEditorService.editor.iframeElementRef.focus();
622
+ editor.focus();
623
+ if (windowEl.getSelection && documentEl.createRange) {
624
+ range.selectNodeContents(editor);
625
+ range.collapse(false);
626
+ const sel = windowEl.getSelection();
627
+ sel?.removeAllRanges();
628
+ sel?.addRange(range);
629
+ }
630
+ }
631
+ else {
632
+ // Cursor may not be active, restore it
633
+ this.#textEditorService.editor.iframeElementRef.focus();
634
+ iframeDocumentEl.body.focus();
618
635
  }
619
- }
620
- else {
621
- // Cursor may not be active, restore it
622
- this.#textEditorService.editor.iframeElementRef.focus();
623
- iframeDocumentEl.body.focus();
624
636
  }
625
637
  }
626
638
  }
@@ -642,48 +654,58 @@ class SkyTextEditorAdapterService {
642
654
  if (selectedEl) {
643
655
  return this.#getParent(selectedEl, 'a');
644
656
  }
645
- /* istanbul ignore next */
646
657
  return undefined;
647
658
  }
648
659
  saveSelection() {
649
- return this.#selectionService.getCurrentSelectionRange(this.#getIframeDocumentEl(), this.#getContentWindowEl());
660
+ const documentEl = this.#getIframeDocumentEl();
661
+ const windowEl = this.#getContentWindowEl();
662
+ if (documentEl && windowEl) {
663
+ return this.#selectionService.getCurrentSelectionRange(documentEl, windowEl);
664
+ }
665
+ return undefined;
650
666
  }
651
667
  selectElement(element) {
652
- this.#selectionService.selectElement(this.#getIframeDocumentEl(), this.#getContentWindowEl(), element);
668
+ const documentEl = this.#getIframeDocumentEl();
669
+ const windowEl = this.#getContentWindowEl();
670
+ if (documentEl && windowEl) {
671
+ this.#selectionService.selectElement(documentEl, windowEl, element);
672
+ }
653
673
  }
654
674
  setErrorAttributes(errorId, errors) {
655
675
  const documentEl = this.#getIframeDocumentEl();
656
- documentEl.body.setAttribute('aria-invalid', (!!errors).toString());
676
+ documentEl?.body.setAttribute('aria-invalid', (!!errors).toString());
657
677
  if (errors && errorId) {
658
- documentEl.body.setAttribute('aria-errormessage', errorId);
678
+ documentEl?.body.setAttribute('aria-errormessage', errorId);
659
679
  }
660
680
  else {
661
- documentEl.body.removeAttribute('aria-errormessage');
681
+ documentEl?.body.removeAttribute('aria-errormessage');
662
682
  }
663
683
  }
664
684
  setLabelAttribute(label) {
665
685
  if (label) {
666
686
  const documentEl = this.#getIframeDocumentEl();
667
- documentEl.body.setAttribute('aria-label', label);
687
+ documentEl?.body.setAttribute('aria-label', label);
668
688
  }
669
689
  }
670
690
  setPlaceholder(placeholder) {
671
691
  const documentEl = this.#getIframeDocumentEl();
672
- documentEl.body.setAttribute('data-placeholder', placeholder || '');
692
+ documentEl?.body.setAttribute('data-placeholder', placeholder || '');
673
693
  }
674
694
  setRequiredAttribute(required) {
675
695
  const documentEl = this.#getIframeDocumentEl();
676
- documentEl.body.setAttribute('aria-required', required.toString());
696
+ documentEl?.body.setAttribute('aria-required', required.toString());
677
697
  }
678
698
  async setFontSize(fontSize) {
679
699
  const doc = this.#getIframeDocumentEl();
680
700
  await this.execCommand({ command: 'fontSize', value: '1' });
681
- const fontElements = Array.from(doc.querySelectorAll('font[size="1"]'));
682
- for (const element of fontElements) {
683
- element.removeAttribute('size');
684
- element.style.fontSize = fontSize + 'px';
701
+ if (doc) {
702
+ const fontElements = Array.from(doc.querySelectorAll('font[size="1"]'));
703
+ for (const element of fontElements) {
704
+ element.removeAttribute('size');
705
+ element.style.fontSize = fontSize + 'px';
706
+ }
707
+ this.#cleanUpBlankStyleTags(doc);
685
708
  }
686
- this.#cleanUpBlankStyleTags(doc);
687
709
  this.focusEditor();
688
710
  this.#textEditorService.editor.commandChangeObservable.next();
689
711
  }
@@ -772,8 +794,8 @@ class SkyTextEditorAdapterService {
772
794
  ? element.contentWindow.document
773
795
  : element.contentDocument;
774
796
  // Firefox bug where we need to open/close to cancel load so it doesn't overwrite attrs
775
- documentEl.open();
776
- documentEl.close();
797
+ documentEl?.open();
798
+ documentEl?.close();
777
799
  const selectionObservable = new Subject();
778
800
  const selectionListener = () => selectionObservable.next();
779
801
  const clickObservable = new Subject();
@@ -785,12 +807,12 @@ class SkyTextEditorAdapterService {
785
807
  const focusListener = () => focusObservable.next();
786
808
  const inputObservable = new Subject();
787
809
  const inputListener = () => inputObservable.next();
788
- documentEl.addEventListener('selectionchange', selectionListener);
789
- documentEl.addEventListener('input', inputListener);
790
- documentEl.addEventListener('mousedown', clickListener);
791
- documentEl.body.addEventListener('paste', pasteListener);
792
- documentEl.body.addEventListener('blur', blurListener);
793
- documentEl.body.addEventListener('focusin', focusListener);
810
+ documentEl?.addEventListener('selectionchange', selectionListener);
811
+ documentEl?.addEventListener('input', inputListener);
812
+ documentEl?.addEventListener('mousedown', clickListener);
813
+ documentEl?.body.addEventListener('paste', pasteListener);
814
+ documentEl?.body.addEventListener('blur', blurListener);
815
+ documentEl?.body.addEventListener('focusin', focusListener);
794
816
  return {
795
817
  blurObservable,
796
818
  clickObservable,
@@ -821,7 +843,11 @@ class SkyTextEditorAdapterService {
821
843
  };
822
844
  }
823
845
  #getCurrentSelectionParentElement() {
824
- return this.#selectionService.getCurrentSelectionParentElement(this.#getIframeDocumentEl());
846
+ const documentEl = this.#getIframeDocumentEl();
847
+ if (documentEl) {
848
+ return this.#selectionService.getCurrentSelectionParentElement(documentEl);
849
+ }
850
+ return undefined;
825
851
  }
826
852
  #getColor(documentEl, selector) {
827
853
  const commandValue = documentEl.queryCommandValue(selector);
@@ -862,7 +888,10 @@ class SkyTextEditorAdapterService {
862
888
  }
863
889
  editorSelected() {
864
890
  const documentEl = this.#getIframeDocumentEl();
865
- return this.#selectionService.isElementSelected(documentEl, documentEl.body);
891
+ if (documentEl) {
892
+ return this.#selectionService.isElementSelected(documentEl, documentEl.body);
893
+ }
894
+ return false;
866
895
  }
867
896
  #cleanUpBlankStyleTags(doc) {
868
897
  const orphanElements = Array.from(doc.querySelectorAll('font,span,*[style=""]'));
@@ -904,7 +933,7 @@ class SkyTextEditorAdapterService {
904
933
  aFocusableChild.tabIndex = disabled ? -1 : 0;
905
934
  });
906
935
  }
907
- this.#getIframeDocumentEl().body.setAttribute('contenteditable', disabled ? 'false' : 'true');
936
+ this.#getIframeDocumentEl()?.body.setAttribute('contenteditable', disabled ? 'false' : 'true');
908
937
  }
909
938
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: SkyTextEditorAdapterService, deps: [{ token: SkyTextEditorSelectionService }, { token: SkyTextEditorService }, { token: i3.SkyAppWindowRef }], target: i0.ɵɵFactoryTarget.Injectable }); }
910
939
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: SkyTextEditorAdapterService }); }
@@ -1394,7 +1423,7 @@ class SkyTextEditorToolbarComponent {
1394
1423
  return undefined;
1395
1424
  }
1396
1425
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: SkyTextEditorToolbarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1397
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: SkyTextEditorToolbarComponent, isStandalone: true, selector: "sky-text-editor-toolbar", inputs: { editorFocusStream: "editorFocusStream", fontList: "fontList", fontSizeList: "fontSizeList", toolbarActions: "toolbarActions", linkWindowOptions: "linkWindowOptions", styleState: "styleState", disabled: ["disabled", "disabled", booleanAttribute] }, ngImport: i0, template: "@for (action of toolbarActions; track action) {\n <sky-toolbar-item\n class=\"sky-text-editor-toolbar-action\"\n [ngClass]=\"'sky-text-editor-toolbar-action-' + action\"\n >\n @switch (action) {\n @case ('font-family') {\n <sky-dropdown\n class=\"sky-text-editor-font-picker\"\n [disabled]=\"disabled\"\n [label]=\"'Font: ' + styleStateFontName\"\n [messageStream]=\"fontPickerStream\"\n >\n <sky-dropdown-button\n [ngStyle]=\"{\n 'font-family': styleState.font\n }\"\n >\n {{ styleStateFontName }}\n </sky-dropdown-button>\n <sky-dropdown-menu>\n @for (fontModel of fontList; track fontModel) {\n <sky-dropdown-item>\n <button\n type=\"button\"\n [ngStyle]=\"{\n 'font-family': fontModel.value\n }\"\n (click)=\"execCommand('fontname', fontModel.name)\"\n >\n {{ fontModel.name }}\n </button>\n </sky-dropdown-item>\n }\n </sky-dropdown-menu>\n </sky-dropdown>\n }\n @case ('font-size') {\n <sky-dropdown\n class=\"sky-text-editor-font-size-picker\"\n [disabled]=\"disabled\"\n [label]=\"'Font size: ' + styleState.fontSize + 'px'\"\n [messageStream]=\"fontSizeStream\"\n >\n <sky-dropdown-button\n [ngStyle]=\"{\n 'font-family': styleState.fontSize\n }\"\n >\n {{ styleState.fontSize + 'px' }}\n </sky-dropdown-button>\n <sky-dropdown-menu>\n @for (size of fontSizeList; track size) {\n <sky-dropdown-item>\n <button type=\"button\" (click)=\"changeFontSize(size)\">\n {{ size + 'px' }}\n </button>\n </sky-dropdown-item>\n }\n </sky-dropdown-menu>\n </sky-dropdown>\n }\n @case ('font-style') {\n <div class=\"sky-switch-icon-group sky-text-editor-font-style-picker\">\n <sky-checkbox\n icon=\"bold\"\n label=\"Bold\"\n title=\"Bold\"\n [disabled]=\"disabled\"\n [ngModel]=\"styleState.boldState\"\n (ngModelChange)=\"\n toggleFontStyle(styleState.boldState, $event, 'bold')\n \"\n />\n <sky-checkbox\n icon=\"italic\"\n label=\"Italicized\"\n title=\"Italicized\"\n [disabled]=\"disabled\"\n [ngModel]=\"styleState.italicState\"\n (ngModelChange)=\"\n toggleFontStyle(styleState.italicState, $event, 'italic')\n \"\n />\n <sky-checkbox\n icon=\"underline\"\n label=\"Underline\"\n title=\"Underline\"\n [disabled]=\"disabled\"\n [ngModel]=\"styleState.underlineState\"\n (ngModelChange)=\"\n toggleFontStyle(styleState.underlineState, $event, 'underline')\n \"\n />\n </div>\n }\n @case ('color') {\n <div class=\"sky-text-editor-colorpicker-group\">\n <div class=\"sky-text-editor-colorpicker-container\">\n <sky-colorpicker\n #colorPicker\n class=\"sky-text-editor-font-color-picker\"\n label=\"Font color\"\n pickerButtonIcon=\"highlighter\"\n pickerButtonIconType=\"skyux\"\n [messageStream]=\"colorpickerStream\"\n [showResetButton]=\"false\"\n (selectedColorChanged)=\"onColorpickerColorChanged($event)\"\n >\n <input\n outputFormat=\"hex\"\n type=\"text\"\n [allowTransparency]=\"false\"\n [disabled]=\"disabled\"\n [ngModel]=\"styleState.fontColor\"\n [skyColorpickerInput]=\"colorPicker\"\n />\n </sky-colorpicker>\n </div>\n <div class=\"sky-text-editor-colorpicker-container\">\n <sky-colorpicker\n #backColorPicker\n class=\"sky-text-editor-background-color-picker\"\n label=\"Background color\"\n pickerButtonIcon=\"text-color\"\n pickerButtonIconType=\"skyux\"\n [messageStream]=\"backColorpickerStream\"\n [showResetButton]=\"false\"\n (selectedColorChanged)=\"onColorpickerColorChanged($event, true)\"\n >\n <input\n outputFormat=\"rgba\"\n type=\"text\"\n [allowTransparency]=\"true\"\n [disabled]=\"disabled\"\n [ngModel]=\"styleState.backColor\"\n [skyColorpickerInput]=\"backColorPicker\"\n />\n </sky-colorpicker>\n </div>\n </div>\n }\n @case ('list') {\n <div class=\"sky-switch-icon-group\">\n <button\n aria-label=\"Bulleted list\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Bulleted list\"\n type=\"button\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('insertUnorderedList')\"\n >\n <sky-icon icon=\"bullet-list\" />\n </button>\n <button\n aria-label=\"Numbered list\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Numbered list\"\n type=\"button\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('insertOrderedList')\"\n >\n <sky-icon icon=\"number-list\" />\n </button>\n </div>\n }\n @case ('alignment') {\n <div class=\"sky-switch-icon-group\">\n <button\n aria-label=\"Align left\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Align left\"\n type=\"button\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('justifyLeft')\"\n >\n <sky-icon icon=\"align-left-text\" />\n </button>\n <button\n aria-label=\"Align center\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Align center\"\n type=\"button\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('justifyCenter')\"\n >\n <sky-icon icon=\"center-text\" />\n </button>\n <button\n aria-label=\"Align right\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Align right\"\n type=\"button\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('justifyRight')\"\n >\n <sky-icon icon=\"align-right-text\" />\n </button>\n </div>\n }\n @case ('indentation') {\n <div class=\"sky-switch-icon-group\">\n <button\n aria-label=\"Outdent\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Outdent\"\n type=\"button\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('outdent')\"\n >\n <sky-icon icon=\"outdent\" />\n </button>\n <button\n aria-label=\"Indent\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Indent\"\n type=\"button\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('indent')\"\n >\n <sky-icon icon=\"indent\" />\n </button>\n </div>\n }\n @case ('undo-redo') {\n <div class=\"sky-switch-icon-group\">\n <button\n aria-label=\"Undo\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Undo\"\n type=\"button\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('undo')\"\n >\n <sky-icon icon=\"undo\" />\n </button>\n <button\n aria-label=\"Redo\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Redo\"\n type=\"button\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('redo')\"\n >\n <sky-icon icon=\"redo\" />\n </button>\n </div>\n }\n @case ('link') {\n <div class=\"sky-switch-icon-group\">\n <button\n aria-label=\"Link\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Link\"\n type=\"button\"\n [disabled]=\"disabled\"\n [ngClass]=\"{\n 'icon-btn-active': styleState.linkState\n }\"\n (click)=\"link()\"\n >\n <sky-icon icon=\"link\" />\n </button>\n <button\n aria-label=\"Unlink\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Unlink\"\n type=\"button\"\n [disabled]=\"!styleState.linkState || disabled\"\n (click)=\"unlink()\"\n >\n <sky-icon icon=\"unlink\" />\n </button>\n </div>\n }\n }\n </sky-toolbar-item>\n}\n", styles: [".sky-text-editor-toolbar-action:not(.sky-theme-modern *){--sky-override-text-editor-border-radius: 0;--sky-override-text-editor-button-border-outer-radius: 3px;--sky-override-text-editor-button-border: 1px solid #cdcfd2;--sky-override-text-editor-colorpicker-spacing: 10px;--sky-override-text-editor-colorpicker-top: 3px}.sky-text-editor-toolbar-action .sky-text-editor-font-picker ::ng-deep .sky-dropdown-button-content-container{width:140px;height:20px;text-align:left}.sky-text-editor-toolbar-action .sky-text-editor-colorpicker-group{display:flex}.sky-text-editor-toolbar-action .sky-text-editor-colorpicker-group .sky-text-editor-colorpicker-container{position:relative;top:var(--sky-override-text-editor-colorpicker-top, -2px);margin-right:var(--sky-override-text-editor-colorpicker-spacing, var(--sky-space-gap-action_group-m))}.sky-text-editor-toolbar-action .sky-text-editor-colorpicker-group .sky-text-editor-colorpicker-container:last-child{margin-right:0}.sky-text-editor-toolbar-action .sky-switch-icon-group .sky-btn{margin-left:0;margin-right:0;border-radius:var(--sky-override-text-editor-border-radius, var(--sky-border-radius-s));border-right:none}.sky-text-editor-toolbar-action .sky-switch-icon-group .sky-btn:first-of-type{border-top-left-radius:var(--sky-override-text-editor-button-border-outer-radius, var(--sky-border-radius-s));border-bottom-left-radius:var(--sky-override-text-editor-button-border-outer-radius, var(--sky-border-radius-s))}.sky-text-editor-toolbar-action .sky-switch-icon-group .sky-btn:last-of-type{border-top-right-radius:var(--sky-override-text-editor-button-border-outer-radius, var(--sky-border-radius-s));border-bottom-right-radius:var(--sky-override-text-editor-button-border-outer-radius, var(--sky-border-radius-s));border-right:var(--sky-override-text-editor-button-border, none)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: SkyCheckboxModule }, { kind: "component", type: i1$3.λ3, selector: "sky-checkbox", inputs: ["label", "labelledBy", "id", "disabled", "tabindex", "name", "helpPopoverContent", "helpPopoverTitle", "icon", "checkboxType", "checked", "indeterminate", "required", "labelText", "labelHidden", "hintText", "stacked", "helpKey"], outputs: ["change", "checkedChange", "disabledChange", "indeterminateChange"] }, { kind: "ngmodule", type: SkyColorpickerModule }, { kind: "component", type: i4$1.λ1, selector: "sky-colorpicker", inputs: ["pickerButtonIcon", "pickerButtonIconType", "label", "labelledBy", "labelText", "labelHidden", "helpKey", "helpPopoverContent", "helpPopoverTitle", "hintText", "stacked", "messageStream", "showResetButton"], outputs: ["selectedColorChanged", "selectedColorApplied"] }, { kind: "directive", type: i4$1.λ2, selector: "[skyColorpickerInput]", inputs: ["skyColorpickerInput", "initialColor", "id", "returnFormat", "outputFormat", "presetColors", "alphaChannel", "allowTransparency"] }, { kind: "ngmodule", type: SkyDropdownModule }, { kind: "component", type: i2.λ2, selector: "sky-dropdown-button" }, { kind: "component", type: i2.λ3, selector: "sky-dropdown", inputs: ["buttonStyle", "buttonType", "disabled", "label", "horizontalAlignment", "messageStream", "title", "trigger"] }, { kind: "component", type: i2.λ1, selector: "sky-dropdown-item", inputs: ["ariaRole"] }, { kind: "component", type: i2.λ4, selector: "sky-dropdown-menu", inputs: ["ariaLabelledBy", "ariaRole", "useNativeFocus"], outputs: ["menuChanges"] }, { kind: "ngmodule", type: SkyIconModule }, { kind: "component", type: i6$1.λ1, selector: "sky-icon", inputs: ["icon", "iconName", "iconType", "size", "fixedWidth", "variant"] }, { kind: "ngmodule", type: SkyThemeModule }, { kind: "ngmodule", type: SkyToolbarModule }, { kind: "component", type: i6.λ39, selector: "sky-toolbar-item" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1426
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.0.5", type: SkyTextEditorToolbarComponent, isStandalone: true, selector: "sky-text-editor-toolbar", inputs: { editorFocusStream: "editorFocusStream", fontList: "fontList", fontSizeList: "fontSizeList", toolbarActions: "toolbarActions", linkWindowOptions: "linkWindowOptions", styleState: "styleState", disabled: ["disabled", "disabled", booleanAttribute] }, ngImport: i0, template: "@for (action of toolbarActions; track action) {\n <sky-toolbar-item\n class=\"sky-text-editor-toolbar-action\"\n [ngClass]=\"'sky-text-editor-toolbar-action-' + action\"\n >\n @switch (action) {\n @case ('font-family') {\n <sky-dropdown\n class=\"sky-text-editor-font-picker\"\n [disabled]=\"disabled\"\n [label]=\"'Font: ' + styleStateFontName\"\n [messageStream]=\"fontPickerStream\"\n >\n <sky-dropdown-button\n [ngStyle]=\"{\n 'font-family': styleState.font\n }\"\n >\n {{ styleStateFontName }}\n </sky-dropdown-button>\n <sky-dropdown-menu>\n @for (fontModel of fontList; track fontModel) {\n <sky-dropdown-item>\n <button\n type=\"button\"\n [ngStyle]=\"{\n 'font-family': fontModel.value\n }\"\n (click)=\"execCommand('fontname', fontModel.name)\"\n >\n {{ fontModel.name }}\n </button>\n </sky-dropdown-item>\n }\n </sky-dropdown-menu>\n </sky-dropdown>\n }\n @case ('font-size') {\n <sky-dropdown\n class=\"sky-text-editor-font-size-picker\"\n [disabled]=\"disabled\"\n [label]=\"'Font size: ' + styleState.fontSize + 'px'\"\n [messageStream]=\"fontSizeStream\"\n >\n <sky-dropdown-button\n [ngStyle]=\"{\n 'font-family': styleState.fontSize\n }\"\n >\n {{ styleState.fontSize + 'px' }}\n </sky-dropdown-button>\n <sky-dropdown-menu>\n @for (size of fontSizeList; track size) {\n <sky-dropdown-item>\n <button type=\"button\" (click)=\"changeFontSize(size)\">\n {{ size + 'px' }}\n </button>\n </sky-dropdown-item>\n }\n </sky-dropdown-menu>\n </sky-dropdown>\n }\n @case ('font-style') {\n <div class=\"sky-switch-icon-group sky-text-editor-font-style-picker\">\n <sky-checkbox\n icon=\"bold\"\n label=\"Bold\"\n title=\"Bold\"\n [disabled]=\"disabled\"\n [ngModel]=\"styleState.boldState\"\n (ngModelChange)=\"\n toggleFontStyle(styleState.boldState, $event, 'bold')\n \"\n />\n <sky-checkbox\n icon=\"italic\"\n label=\"Italicized\"\n title=\"Italicized\"\n [disabled]=\"disabled\"\n [ngModel]=\"styleState.italicState\"\n (ngModelChange)=\"\n toggleFontStyle(styleState.italicState, $event, 'italic')\n \"\n />\n <sky-checkbox\n icon=\"underline\"\n label=\"Underline\"\n title=\"Underline\"\n [disabled]=\"disabled\"\n [ngModel]=\"styleState.underlineState\"\n (ngModelChange)=\"\n toggleFontStyle(styleState.underlineState, $event, 'underline')\n \"\n />\n </div>\n }\n @case ('color') {\n <div class=\"sky-text-editor-colorpicker-group\">\n <div class=\"sky-text-editor-colorpicker-container\">\n <sky-colorpicker\n #colorPicker\n class=\"sky-text-editor-font-color-picker\"\n label=\"Font color\"\n pickerButtonIcon=\"highlighter\"\n pickerButtonIconType=\"skyux\"\n [messageStream]=\"colorpickerStream\"\n [showResetButton]=\"false\"\n (selectedColorChanged)=\"onColorpickerColorChanged($event)\"\n >\n <input\n outputFormat=\"hex\"\n type=\"text\"\n [allowTransparency]=\"false\"\n [disabled]=\"disabled\"\n [ngModel]=\"styleState.fontColor\"\n [skyColorpickerInput]=\"colorPicker\"\n />\n </sky-colorpicker>\n </div>\n <div class=\"sky-text-editor-colorpicker-container\">\n <sky-colorpicker\n #backColorPicker\n class=\"sky-text-editor-background-color-picker\"\n label=\"Background color\"\n pickerButtonIcon=\"text-color\"\n pickerButtonIconType=\"skyux\"\n [messageStream]=\"backColorpickerStream\"\n [showResetButton]=\"false\"\n (selectedColorChanged)=\"onColorpickerColorChanged($event, true)\"\n >\n <input\n outputFormat=\"rgba\"\n type=\"text\"\n [allowTransparency]=\"true\"\n [disabled]=\"disabled\"\n [ngModel]=\"styleState.backColor\"\n [skyColorpickerInput]=\"backColorPicker\"\n />\n </sky-colorpicker>\n </div>\n </div>\n }\n @case ('list') {\n <div class=\"sky-switch-icon-group\">\n <button\n aria-label=\"Bulleted list\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Bulleted list\"\n type=\"button\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('insertUnorderedList')\"\n >\n <sky-icon icon=\"bullet-list\" />\n </button>\n <button\n aria-label=\"Numbered list\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Numbered list\"\n type=\"button\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('insertOrderedList')\"\n >\n <sky-icon icon=\"number-list\" />\n </button>\n </div>\n }\n @case ('alignment') {\n <div class=\"sky-switch-icon-group\">\n <button\n aria-label=\"Align left\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Align left\"\n type=\"button\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('justifyLeft')\"\n >\n <sky-icon icon=\"align-left-text\" />\n </button>\n <button\n aria-label=\"Align center\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Align center\"\n type=\"button\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('justifyCenter')\"\n >\n <sky-icon icon=\"center-text\" />\n </button>\n <button\n aria-label=\"Align right\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Align right\"\n type=\"button\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('justifyRight')\"\n >\n <sky-icon icon=\"align-right-text\" />\n </button>\n </div>\n }\n @case ('indentation') {\n <div class=\"sky-switch-icon-group\">\n <button\n aria-label=\"Outdent\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Outdent\"\n type=\"button\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('outdent')\"\n >\n <sky-icon icon=\"outdent\" />\n </button>\n <button\n aria-label=\"Indent\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Indent\"\n type=\"button\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('indent')\"\n >\n <sky-icon icon=\"indent\" />\n </button>\n </div>\n }\n @case ('undo-redo') {\n <div class=\"sky-switch-icon-group\">\n <button\n aria-label=\"Undo\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Undo\"\n type=\"button\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('undo')\"\n >\n <sky-icon icon=\"undo\" />\n </button>\n <button\n aria-label=\"Redo\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Redo\"\n type=\"button\"\n [disabled]=\"disabled\"\n (click)=\"execCommand('redo')\"\n >\n <sky-icon icon=\"redo\" />\n </button>\n </div>\n }\n @case ('link') {\n <div class=\"sky-switch-icon-group\">\n <button\n aria-label=\"Link\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Link\"\n type=\"button\"\n [disabled]=\"disabled\"\n [ngClass]=\"{\n 'icon-btn-active': styleState.linkState\n }\"\n (click)=\"link()\"\n >\n <sky-icon icon=\"link\" />\n </button>\n <button\n aria-label=\"Unlink\"\n class=\"sky-btn sky-btn-default sky-btn-icon\"\n title=\"Unlink\"\n type=\"button\"\n [disabled]=\"!styleState.linkState || disabled\"\n (click)=\"unlink()\"\n >\n <sky-icon icon=\"unlink\" />\n </button>\n </div>\n }\n }\n </sky-toolbar-item>\n}\n", styles: [".sky-text-editor-toolbar-action:not(.sky-theme-modern *){--sky-override-text-editor-border-radius: 0;--sky-override-text-editor-button-border-outer-radius: 3px;--sky-override-text-editor-button-border: 1px solid #cdcfd2;--sky-override-text-editor-colorpicker-spacing: 10px;--sky-override-text-editor-colorpicker-top: 3px}.sky-text-editor-toolbar-action .sky-text-editor-font-picker ::ng-deep .sky-dropdown-button-content-container{width:140px;height:20px;text-align:left}.sky-text-editor-toolbar-action .sky-text-editor-colorpicker-group{display:flex}.sky-text-editor-toolbar-action .sky-text-editor-colorpicker-group .sky-text-editor-colorpicker-container{position:relative;top:var(--sky-override-text-editor-colorpicker-top, -2px);margin-right:var(--sky-override-text-editor-colorpicker-spacing, var(--sky-space-gap-action_group-m))}.sky-text-editor-toolbar-action .sky-text-editor-colorpicker-group .sky-text-editor-colorpicker-container:last-child{margin-right:0}.sky-text-editor-toolbar-action .sky-switch-icon-group .sky-btn{margin-left:0;margin-right:0;border-radius:var(--sky-override-text-editor-border-radius, var(--sky-border-radius-s));border-right:none}.sky-text-editor-toolbar-action .sky-switch-icon-group .sky-btn:first-of-type{border-top-left-radius:var(--sky-override-text-editor-button-border-outer-radius, var(--sky-border-radius-s));border-bottom-left-radius:var(--sky-override-text-editor-button-border-outer-radius, var(--sky-border-radius-s))}.sky-text-editor-toolbar-action .sky-switch-icon-group .sky-btn:last-of-type{border-top-right-radius:var(--sky-override-text-editor-button-border-outer-radius, var(--sky-border-radius-s));border-bottom-right-radius:var(--sky-override-text-editor-button-border-outer-radius, var(--sky-border-radius-s));border-right:var(--sky-override-text-editor-button-border, none)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: SkyCheckboxModule }, { kind: "component", type: i1$3.λ3, selector: "sky-checkbox", inputs: ["label", "labelledBy", "id", "disabled", "tabindex", "name", "helpPopoverContent", "helpPopoverTitle", "icon", "iconName", "checkboxType", "checked", "indeterminate", "required", "labelText", "labelHidden", "hintText", "stacked", "helpKey"], outputs: ["change", "checkedChange", "disabledChange", "indeterminateChange"] }, { kind: "ngmodule", type: SkyColorpickerModule }, { kind: "component", type: i4$1.λ1, selector: "sky-colorpicker", inputs: ["pickerButtonIcon", "pickerButtonIconType", "label", "labelledBy", "labelText", "labelHidden", "helpKey", "helpPopoverContent", "helpPopoverTitle", "hintText", "stacked", "messageStream", "showResetButton"], outputs: ["selectedColorChanged", "selectedColorApplied"] }, { kind: "directive", type: i4$1.λ2, selector: "[skyColorpickerInput]", inputs: ["skyColorpickerInput", "initialColor", "id", "returnFormat", "outputFormat", "presetColors", "alphaChannel", "allowTransparency"] }, { kind: "ngmodule", type: SkyDropdownModule }, { kind: "component", type: i2.λ2, selector: "sky-dropdown-button" }, { kind: "component", type: i2.λ3, selector: "sky-dropdown", inputs: ["buttonStyle", "buttonType", "disabled", "label", "horizontalAlignment", "messageStream", "title", "trigger"] }, { kind: "component", type: i2.λ1, selector: "sky-dropdown-item", inputs: ["ariaRole"] }, { kind: "component", type: i2.λ4, selector: "sky-dropdown-menu", inputs: ["ariaLabelledBy", "ariaRole", "useNativeFocus"], outputs: ["menuChanges"] }, { kind: "ngmodule", type: SkyIconModule }, { kind: "component", type: i6$1.λ1, selector: "sky-icon", inputs: ["icon", "iconName", "iconType", "size", "fixedWidth", "variant"] }, { kind: "ngmodule", type: SkyThemeModule }, { kind: "ngmodule", type: SkyToolbarModule }, { kind: "component", type: i6.λ39, selector: "sky-toolbar-item" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
1398
1427
  }
1399
1428
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: SkyTextEditorToolbarComponent, decorators: [{
1400
1429
  type: Component,
@@ -1437,22 +1466,7 @@ class SkyTextEditorComponent {
1437
1466
  set disabled(value) {
1438
1467
  if (value !== this.disabled) {
1439
1468
  this.#_disabled = value;
1440
- // Update focusableChildren inside the iframe.
1441
- let focusableChildren;
1442
- /* istanbul ignore else */
1443
- if (this.iframeRef) {
1444
- focusableChildren = this.#coreAdapterService.getFocusableChildren(this.iframeRef.nativeElement.contentDocument.body, {
1445
- ignoreVisibility: true,
1446
- ignoreTabIndex: true,
1447
- });
1448
- if (this.#_disabled) {
1449
- this.#adapterService.disableEditor(focusableChildren, this.iframeRef.nativeElement);
1450
- }
1451
- else {
1452
- this.#adapterService.enableEditor(focusableChildren, this.iframeRef.nativeElement);
1453
- }
1454
- this.#changeDetector.markForCheck();
1455
- }
1469
+ this.#applyDisabledState();
1456
1470
  }
1457
1471
  }
1458
1472
  get disabled() {
@@ -1802,6 +1816,7 @@ class SkyTextEditorComponent {
1802
1816
  if (this.autofocus) {
1803
1817
  this.#adapterService.focusEditor();
1804
1818
  }
1819
+ this.#applyDisabledState();
1805
1820
  this.#initialized = true;
1806
1821
  this.#focusInitialized = false;
1807
1822
  this.#checkAutofocusAndFocus();
@@ -1820,6 +1835,24 @@ class SkyTextEditorComponent {
1820
1835
  this.#_onChange(this.#_value);
1821
1836
  }
1822
1837
  }
1838
+ #applyDisabledState() {
1839
+ // Update focusableChildren inside the iframe.
1840
+ let focusableChildren;
1841
+ /* istanbul ignore else */
1842
+ if (this.iframeRef?.nativeElement.contentDocument?.body) {
1843
+ focusableChildren = this.#coreAdapterService.getFocusableChildren(this.iframeRef.nativeElement.contentDocument.body, {
1844
+ ignoreVisibility: true,
1845
+ ignoreTabIndex: true,
1846
+ });
1847
+ if (this.#_disabled) {
1848
+ this.#adapterService.disableEditor(focusableChildren, this.iframeRef.nativeElement);
1849
+ }
1850
+ else {
1851
+ this.#adapterService.enableEditor(focusableChildren, this.iframeRef.nativeElement);
1852
+ }
1853
+ this.#changeDetector.markForCheck();
1854
+ }
1855
+ }
1823
1856
  /* istanbul ignore next */
1824
1857
  #_onTouched;
1825
1858
  /* istanbul ignore next */
@@ -1908,6 +1941,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImpor
1908
1941
  args: ['class.sky-form-control']
1909
1942
  }] } });
1910
1943
 
1944
+ /**
1945
+ * @docsIncludeIds SkyTextEditorComponent, SkyTextEditorFont, SkyTextEditorLinkWindowOptionsType, SkyTextEditorMenuType, SkyTextEditorStyleState, SkyTextEditorMergeField, SkyTextEditorToolbarActionType
1946
+ */
1911
1947
  class SkyTextEditorModule {
1912
1948
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: SkyTextEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1913
1949
  static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.5", ngImport: i0, type: SkyTextEditorModule, imports: [SkyTextEditorComponent], exports: [SkyTextEditorComponent, SkyFormErrorModule] }); }