@semantic-components/editor 0.62.0 → 0.64.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/esm2022/index.js +2 -0
- package/esm2022/index.js.map +1 -0
- package/esm2022/lib/components/editor/editor-align-center-button.js +38 -0
- package/esm2022/lib/components/editor/editor-align-center-button.js.map +1 -0
- package/esm2022/lib/components/editor/editor-align-justify-button.js +38 -0
- package/esm2022/lib/components/editor/editor-align-justify-button.js.map +1 -0
- package/esm2022/lib/components/editor/editor-align-left-button.js +37 -0
- package/esm2022/lib/components/editor/editor-align-left-button.js.map +1 -0
- package/esm2022/lib/components/editor/editor-align-right-button.js +37 -0
- package/esm2022/lib/components/editor/editor-align-right-button.js.map +1 -0
- package/esm2022/lib/components/editor/editor-blockquote-button.js +37 -0
- package/esm2022/lib/components/editor/editor-blockquote-button.js.map +1 -0
- package/esm2022/lib/components/editor/editor-bold-button.js +37 -0
- package/esm2022/lib/components/editor/editor-bold-button.js.map +1 -0
- package/esm2022/lib/components/editor/editor-bullet-list-button.js +37 -0
- package/esm2022/lib/components/editor/editor-bullet-list-button.js.map +1 -0
- package/esm2022/lib/components/editor/editor-char-count.js +40 -0
- package/esm2022/lib/components/editor/editor-char-count.js.map +1 -0
- package/esm2022/lib/components/editor/editor-clear-formatting-button.js +36 -0
- package/esm2022/lib/components/editor/editor-clear-formatting-button.js.map +1 -0
- package/esm2022/lib/components/editor/editor-code-button.js +46 -0
- package/esm2022/lib/components/editor/editor-code-button.js.map +1 -0
- package/esm2022/lib/components/editor/editor-content.js +78 -0
- package/esm2022/lib/components/editor/editor-content.js.map +1 -0
- package/esm2022/lib/components/editor/editor-count.js +27 -0
- package/esm2022/lib/components/editor/editor-count.js.map +1 -0
- package/esm2022/lib/components/editor/editor-footer.js +27 -0
- package/esm2022/lib/components/editor/editor-footer.js.map +1 -0
- package/esm2022/lib/components/editor/editor-header.js +27 -0
- package/esm2022/lib/components/editor/editor-header.js.map +1 -0
- package/esm2022/lib/components/editor/editor-heading-select.js +48 -0
- package/esm2022/lib/components/editor/editor-heading-select.js.map +1 -0
- package/esm2022/lib/components/editor/editor-horizontal-rule-button.js +36 -0
- package/esm2022/lib/components/editor/editor-horizontal-rule-button.js.map +1 -0
- package/esm2022/lib/components/editor/editor-italic-button.js +37 -0
- package/esm2022/lib/components/editor/editor-italic-button.js.map +1 -0
- package/esm2022/lib/components/editor/editor-link-button.js +52 -0
- package/esm2022/lib/components/editor/editor-link-button.js.map +1 -0
- package/esm2022/lib/components/editor/editor-numbered-list-button.js +37 -0
- package/esm2022/lib/components/editor/editor-numbered-list-button.js.map +1 -0
- package/esm2022/lib/components/editor/editor-redo-button.js +36 -0
- package/esm2022/lib/components/editor/editor-redo-button.js.map +1 -0
- package/esm2022/lib/components/editor/editor-separator.js +23 -0
- package/esm2022/lib/components/editor/editor-separator.js.map +1 -0
- package/esm2022/lib/components/editor/editor-strikethrough-button.js +37 -0
- package/esm2022/lib/components/editor/editor-strikethrough-button.js.map +1 -0
- package/esm2022/lib/components/editor/editor-toolbar-group.js +27 -0
- package/esm2022/lib/components/editor/editor-toolbar-group.js.map +1 -0
- package/esm2022/lib/components/editor/editor-toolbar.js +29 -0
- package/esm2022/lib/components/editor/editor-toolbar.js.map +1 -0
- package/esm2022/lib/components/editor/editor-underline-button.js +37 -0
- package/esm2022/lib/components/editor/editor-underline-button.js.map +1 -0
- package/esm2022/lib/components/editor/editor-undo-button.js +36 -0
- package/esm2022/lib/components/editor/editor-undo-button.js.map +1 -0
- package/esm2022/lib/components/editor/editor-word-count.js +42 -0
- package/esm2022/lib/components/editor/editor-word-count.js.map +1 -0
- package/esm2022/lib/components/editor/editor.js +197 -0
- package/esm2022/lib/components/editor/editor.js.map +1 -0
- package/{src/lib/components/editor/index.ts → esm2022/lib/components/editor/index.js} +1 -8
- package/esm2022/lib/components/editor/index.js.map +1 -0
- package/esm2022/lib/components/index.js +2 -0
- package/esm2022/lib/components/index.js.map +1 -0
- package/esm2022/semantic-components-editor.js +5 -0
- package/esm2022/semantic-components-editor.js.map +1 -0
- package/lib/components/editor/editor-align-center-button.d.ts +9 -0
- package/lib/components/editor/editor-align-justify-button.d.ts +9 -0
- package/lib/components/editor/editor-align-left-button.d.ts +9 -0
- package/lib/components/editor/editor-align-right-button.d.ts +9 -0
- package/lib/components/editor/editor-blockquote-button.d.ts +9 -0
- package/lib/components/editor/editor-bold-button.d.ts +9 -0
- package/lib/components/editor/editor-bullet-list-button.d.ts +9 -0
- package/lib/components/editor/editor-char-count.d.ts +10 -0
- package/lib/components/editor/editor-clear-formatting-button.d.ts +9 -0
- package/lib/components/editor/editor-code-button.d.ts +9 -0
- package/lib/components/editor/editor-content.d.ts +18 -0
- package/lib/components/editor/editor-count.d.ts +7 -0
- package/lib/components/editor/editor-footer.d.ts +7 -0
- package/lib/components/editor/editor-header.d.ts +7 -0
- package/lib/components/editor/editor-heading-select.d.ts +9 -0
- package/lib/components/editor/editor-horizontal-rule-button.d.ts +9 -0
- package/lib/components/editor/editor-italic-button.d.ts +9 -0
- package/lib/components/editor/editor-link-button.d.ts +9 -0
- package/lib/components/editor/editor-numbered-list-button.d.ts +9 -0
- package/lib/components/editor/editor-redo-button.d.ts +9 -0
- package/lib/components/editor/editor-separator.d.ts +7 -0
- package/lib/components/editor/editor-strikethrough-button.d.ts +9 -0
- package/lib/components/editor/editor-toolbar-group.d.ts +7 -0
- package/lib/components/editor/editor-toolbar.d.ts +7 -0
- package/lib/components/editor/editor-underline-button.d.ts +9 -0
- package/lib/components/editor/editor-undo-button.d.ts +9 -0
- package/lib/components/editor/editor-word-count.d.ts +10 -0
- package/lib/components/editor/editor.d.ts +29 -0
- package/lib/components/editor/index.d.ts +28 -0
- package/package.json +15 -3
- package/semantic-components-editor.d.ts +5 -0
- package/eslint.config.mjs +0 -48
- package/ng-package.json +0 -8
- package/project.json +0 -28
- package/src/lib/components/editor/README.md +0 -354
- package/src/lib/components/editor/editor-align-center-button.ts +0 -45
- package/src/lib/components/editor/editor-align-justify-button.ts +0 -45
- package/src/lib/components/editor/editor-align-left-button.ts +0 -44
- package/src/lib/components/editor/editor-align-right-button.ts +0 -44
- package/src/lib/components/editor/editor-blockquote-button.ts +0 -44
- package/src/lib/components/editor/editor-bold-button.ts +0 -44
- package/src/lib/components/editor/editor-bullet-list-button.ts +0 -44
- package/src/lib/components/editor/editor-char-count.ts +0 -42
- package/src/lib/components/editor/editor-clear-formatting-button.ts +0 -42
- package/src/lib/components/editor/editor-code-button.ts +0 -52
- package/src/lib/components/editor/editor-content.ts +0 -107
- package/src/lib/components/editor/editor-count.ts +0 -28
- package/src/lib/components/editor/editor-footer.ts +0 -30
- package/src/lib/components/editor/editor-header.ts +0 -27
- package/src/lib/components/editor/editor-heading-select.ts +0 -48
- package/src/lib/components/editor/editor-horizontal-rule-button.ts +0 -42
- package/src/lib/components/editor/editor-italic-button.ts +0 -44
- package/src/lib/components/editor/editor-link-button.ts +0 -58
- package/src/lib/components/editor/editor-numbered-list-button.ts +0 -44
- package/src/lib/components/editor/editor-redo-button.ts +0 -42
- package/src/lib/components/editor/editor-separator.ts +0 -25
- package/src/lib/components/editor/editor-strikethrough-button.ts +0 -44
- package/src/lib/components/editor/editor-toolbar-group.ts +0 -27
- package/src/lib/components/editor/editor-toolbar.ts +0 -32
- package/src/lib/components/editor/editor-underline-button.ts +0 -44
- package/src/lib/components/editor/editor-undo-button.ts +0 -42
- package/src/lib/components/editor/editor-word-count.ts +0 -43
- package/src/lib/components/editor/editor.ts +0 -211
- package/tsconfig.json +0 -28
- package/tsconfig.lib.json +0 -12
- package/tsconfig.lib.prod.json +0 -7
- /package/{src/index.ts → index.d.ts} +0 -0
- /package/{src/lib/components/index.ts → lib/components/index.d.ts} +0 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Component, ChangeDetectionStrategy, computed, input, inject, ViewEncapsulation, } from '@angular/core';
|
|
2
|
+
import { cn } from '@semantic-components/ui';
|
|
3
|
+
import { SC_EDITOR } from './editor';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export class ScEditorUnderlineButton {
|
|
6
|
+
editor = inject(SC_EDITOR);
|
|
7
|
+
classInput = input('', { ...(ngDevMode ? { debugName: "classInput" } : {}), alias: 'class' });
|
|
8
|
+
class = computed(() => cn('p-1.5 rounded hover:bg-accent disabled:opacity-50 [&_svg]:size-4', this.editor.isUnderline() && 'bg-accent text-accent-foreground', this.classInput()), ...(ngDevMode ? [{ debugName: "class" }] : []));
|
|
9
|
+
onClick() {
|
|
10
|
+
this.editor.execCommand('underline');
|
|
11
|
+
}
|
|
12
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: ScEditorUnderlineButton, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
13
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.4", type: ScEditorUnderlineButton, isStandalone: true, selector: "button[sc-editor-underline]", inputs: { classInput: { classPropertyName: "classInput", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "editor-underline", "type": "button" }, listeners: { "click": "onClick()" }, properties: { "class": "class()", "disabled": "editor.disabled()", "attr.aria-pressed": "editor.isUnderline()", "attr.title": "\"Underline (Ctrl+U)\"" } }, ngImport: i0, template: `
|
|
14
|
+
<ng-content />
|
|
15
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
16
|
+
}
|
|
17
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: ScEditorUnderlineButton, decorators: [{
|
|
18
|
+
type: Component,
|
|
19
|
+
args: [{
|
|
20
|
+
selector: 'button[sc-editor-underline]',
|
|
21
|
+
template: `
|
|
22
|
+
<ng-content />
|
|
23
|
+
`,
|
|
24
|
+
host: {
|
|
25
|
+
'data-slot': 'editor-underline',
|
|
26
|
+
type: 'button',
|
|
27
|
+
'[class]': 'class()',
|
|
28
|
+
'[disabled]': 'editor.disabled()',
|
|
29
|
+
'[attr.aria-pressed]': 'editor.isUnderline()',
|
|
30
|
+
'[attr.title]': '"Underline (Ctrl+U)"',
|
|
31
|
+
'(click)': 'onClick()',
|
|
32
|
+
},
|
|
33
|
+
encapsulation: ViewEncapsulation.None,
|
|
34
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
35
|
+
}]
|
|
36
|
+
}], propDecorators: { classInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
37
|
+
//# sourceMappingURL=editor-underline-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor-underline-button.js","sourceRoot":"","sources":["../../../../../../../libs/editor/src/lib/components/editor/editor-underline-button.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,uBAAuB,EACvB,QAAQ,EACR,KAAK,EACL,MAAM,EACN,iBAAiB,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,yBAAyB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;;AAmBrC,MAAM,OAAO,uBAAuB;IACzB,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;IAC3B,UAAU,GAAG,KAAK,CAAS,EAAE,uDAAI,KAAK,EAAE,OAAO,GAAG,CAAC;IAEzC,KAAK,GAAG,QAAQ,CAAC,GAAG,EAAE,CACvC,EAAE,CACA,kEAAkE,EAClE,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,IAAI,kCAAkC,EAC/D,IAAI,CAAC,UAAU,EAAE,CAClB,iDACF,CAAC;IAEF,OAAO;QACL,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IACvC,CAAC;uGAdU,uBAAuB;2FAAvB,uBAAuB,ifAfxB;;GAET;;2FAaU,uBAAuB;kBAjBnC,SAAS;mBAAC;oBACT,QAAQ,EAAE,6BAA6B;oBACvC,QAAQ,EAAE;;GAET;oBACD,IAAI,EAAE;wBACJ,WAAW,EAAE,kBAAkB;wBAC/B,IAAI,EAAE,QAAQ;wBACd,SAAS,EAAE,SAAS;wBACpB,YAAY,EAAE,mBAAmB;wBACjC,qBAAqB,EAAE,sBAAsB;wBAC7C,cAAc,EAAE,sBAAsB;wBACtC,SAAS,EAAE,WAAW;qBACvB;oBACD,aAAa,EAAE,iBAAiB,CAAC,IAAI;oBACrC,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD","sourcesContent":["import {\n Component,\n ChangeDetectionStrategy,\n computed,\n input,\n inject,\n ViewEncapsulation,\n} from '@angular/core';\nimport { cn } from '@semantic-components/ui';\nimport { SC_EDITOR } from './editor';\n\n@Component({\n selector: 'button[sc-editor-underline]',\n template: `\n <ng-content />\n `,\n host: {\n 'data-slot': 'editor-underline',\n type: 'button',\n '[class]': 'class()',\n '[disabled]': 'editor.disabled()',\n '[attr.aria-pressed]': 'editor.isUnderline()',\n '[attr.title]': '\"Underline (Ctrl+U)\"',\n '(click)': 'onClick()',\n },\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ScEditorUnderlineButton {\n readonly editor = inject(SC_EDITOR);\n readonly classInput = input<string>('', { alias: 'class' });\n\n protected readonly class = computed(() =>\n cn(\n 'p-1.5 rounded hover:bg-accent disabled:opacity-50 [&_svg]:size-4',\n this.editor.isUnderline() && 'bg-accent text-accent-foreground',\n this.classInput(),\n ),\n );\n\n onClick(): void {\n this.editor.execCommand('underline');\n }\n}\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Component, ChangeDetectionStrategy, computed, input, inject, ViewEncapsulation, } from '@angular/core';
|
|
2
|
+
import { cn } from '@semantic-components/ui';
|
|
3
|
+
import { SC_EDITOR } from './editor';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export class ScEditorUndoButton {
|
|
6
|
+
editor = inject(SC_EDITOR);
|
|
7
|
+
classInput = input('', { ...(ngDevMode ? { debugName: "classInput" } : {}), alias: 'class' });
|
|
8
|
+
class = computed(() => cn('p-1.5 rounded hover:bg-accent disabled:opacity-50 [&_svg]:size-4', this.classInput()), ...(ngDevMode ? [{ debugName: "class" }] : []));
|
|
9
|
+
onClick() {
|
|
10
|
+
this.editor.execCommand('undo');
|
|
11
|
+
}
|
|
12
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: ScEditorUndoButton, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
13
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.4", type: ScEditorUndoButton, isStandalone: true, selector: "button[sc-editor-undo]", inputs: { classInput: { classPropertyName: "classInput", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "editor-undo", "type": "button" }, listeners: { "click": "onClick()" }, properties: { "class": "class()", "disabled": "editor.disabled() || !editor.canUndo()", "attr.title": "\"Undo (Ctrl+Z)\"" } }, ngImport: i0, template: `
|
|
14
|
+
<ng-content />
|
|
15
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
16
|
+
}
|
|
17
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: ScEditorUndoButton, decorators: [{
|
|
18
|
+
type: Component,
|
|
19
|
+
args: [{
|
|
20
|
+
selector: 'button[sc-editor-undo]',
|
|
21
|
+
template: `
|
|
22
|
+
<ng-content />
|
|
23
|
+
`,
|
|
24
|
+
host: {
|
|
25
|
+
'data-slot': 'editor-undo',
|
|
26
|
+
type: 'button',
|
|
27
|
+
'[class]': 'class()',
|
|
28
|
+
'[disabled]': 'editor.disabled() || !editor.canUndo()',
|
|
29
|
+
'[attr.title]': '"Undo (Ctrl+Z)"',
|
|
30
|
+
'(click)': 'onClick()',
|
|
31
|
+
},
|
|
32
|
+
encapsulation: ViewEncapsulation.None,
|
|
33
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
34
|
+
}]
|
|
35
|
+
}], propDecorators: { classInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
36
|
+
//# sourceMappingURL=editor-undo-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor-undo-button.js","sourceRoot":"","sources":["../../../../../../../libs/editor/src/lib/components/editor/editor-undo-button.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,uBAAuB,EACvB,QAAQ,EACR,KAAK,EACL,MAAM,EACN,iBAAiB,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,yBAAyB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;;AAkBrC,MAAM,OAAO,kBAAkB;IACpB,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;IAC3B,UAAU,GAAG,KAAK,CAAS,EAAE,uDAAI,KAAK,EAAE,OAAO,GAAG,CAAC;IAEzC,KAAK,GAAG,QAAQ,CAAC,GAAG,EAAE,CACvC,EAAE,CACA,kEAAkE,EAClE,IAAI,CAAC,UAAU,EAAE,CAClB,iDACF,CAAC;IAEF,OAAO;QACL,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;uGAbU,kBAAkB;2FAAlB,kBAAkB,0cAdnB;;GAET;;2FAYU,kBAAkB;kBAhB9B,SAAS;mBAAC;oBACT,QAAQ,EAAE,wBAAwB;oBAClC,QAAQ,EAAE;;GAET;oBACD,IAAI,EAAE;wBACJ,WAAW,EAAE,aAAa;wBAC1B,IAAI,EAAE,QAAQ;wBACd,SAAS,EAAE,SAAS;wBACpB,YAAY,EAAE,wCAAwC;wBACtD,cAAc,EAAE,iBAAiB;wBACjC,SAAS,EAAE,WAAW;qBACvB;oBACD,aAAa,EAAE,iBAAiB,CAAC,IAAI;oBACrC,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD","sourcesContent":["import {\n Component,\n ChangeDetectionStrategy,\n computed,\n input,\n inject,\n ViewEncapsulation,\n} from '@angular/core';\nimport { cn } from '@semantic-components/ui';\nimport { SC_EDITOR } from './editor';\n\n@Component({\n selector: 'button[sc-editor-undo]',\n template: `\n <ng-content />\n `,\n host: {\n 'data-slot': 'editor-undo',\n type: 'button',\n '[class]': 'class()',\n '[disabled]': 'editor.disabled() || !editor.canUndo()',\n '[attr.title]': '\"Undo (Ctrl+Z)\"',\n '(click)': 'onClick()',\n },\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ScEditorUndoButton {\n readonly editor = inject(SC_EDITOR);\n readonly classInput = input<string>('', { alias: 'class' });\n\n protected readonly class = computed(() =>\n cn(\n 'p-1.5 rounded hover:bg-accent disabled:opacity-50 [&_svg]:size-4',\n this.classInput(),\n ),\n );\n\n onClick(): void {\n this.editor.execCommand('undo');\n }\n}\n"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Component, ChangeDetectionStrategy, computed, input, inject, ViewEncapsulation, } from '@angular/core';
|
|
2
|
+
import { cn } from '@semantic-components/ui';
|
|
3
|
+
import { SC_EDITOR } from './editor';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export class ScEditorWordCount {
|
|
6
|
+
editor = inject(SC_EDITOR);
|
|
7
|
+
classInput = input('', { ...(ngDevMode ? { debugName: "classInput" } : {}), alias: 'class' });
|
|
8
|
+
class = computed(() => cn('', this.classInput()), ...(ngDevMode ? [{ debugName: "class" }] : []));
|
|
9
|
+
wordCount = computed(() => {
|
|
10
|
+
const text = this.getPlainText().trim();
|
|
11
|
+
if (!text)
|
|
12
|
+
return 0;
|
|
13
|
+
return text.split(/\s+/).filter(Boolean).length;
|
|
14
|
+
}, ...(ngDevMode ? [{ debugName: "wordCount" }] : []));
|
|
15
|
+
getPlainText() {
|
|
16
|
+
const editorInstance = this.editor.editorInstance();
|
|
17
|
+
if (editorInstance) {
|
|
18
|
+
return editorInstance.getText();
|
|
19
|
+
}
|
|
20
|
+
return this.editor.contentElement()?.textContent || '';
|
|
21
|
+
}
|
|
22
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: ScEditorWordCount, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
23
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.1.4", type: ScEditorWordCount, isStandalone: true, selector: "span[sc-editor-word-count]", inputs: { classInput: { classPropertyName: "classInput", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "editor-word-count" }, properties: { "class": "class()" } }, ngImport: i0, template: `
|
|
24
|
+
{{ wordCount() }} words
|
|
25
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
26
|
+
}
|
|
27
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: ScEditorWordCount, decorators: [{
|
|
28
|
+
type: Component,
|
|
29
|
+
args: [{
|
|
30
|
+
selector: 'span[sc-editor-word-count]',
|
|
31
|
+
template: `
|
|
32
|
+
{{ wordCount() }} words
|
|
33
|
+
`,
|
|
34
|
+
host: {
|
|
35
|
+
'data-slot': 'editor-word-count',
|
|
36
|
+
'[class]': 'class()',
|
|
37
|
+
},
|
|
38
|
+
encapsulation: ViewEncapsulation.None,
|
|
39
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
40
|
+
}]
|
|
41
|
+
}], propDecorators: { classInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
42
|
+
//# sourceMappingURL=editor-word-count.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor-word-count.js","sourceRoot":"","sources":["../../../../../../../libs/editor/src/lib/components/editor/editor-word-count.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,uBAAuB,EACvB,QAAQ,EACR,KAAK,EACL,MAAM,EACN,iBAAiB,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,yBAAyB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;;AAcrC,MAAM,OAAO,iBAAiB;IACnB,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;IAC3B,UAAU,GAAG,KAAK,CAAS,EAAE,uDAAI,KAAK,EAAE,OAAO,GAAG,CAAC;IAEzC,KAAK,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,iDAAC,CAAC;IAElD,SAAS,GAAG,QAAQ,CAAC,GAAG,EAAE;QAC3C,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,CAAC;QACxC,IAAI,CAAC,IAAI;YAAE,OAAO,CAAC,CAAC;QACpB,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;IAClD,CAAC,qDAAC,CAAC;IAEK,YAAY;QAClB,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;QACpD,IAAI,cAAc,EAAE,CAAC;YACnB,OAAO,cAAc,CAAC,OAAO,EAAE,CAAC;QAClC,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,EAAE,WAAW,IAAI,EAAE,CAAC;IACzD,CAAC;uGAlBU,iBAAiB;2FAAjB,iBAAiB,oUAVlB;;GAET;;2FAQU,iBAAiB;kBAZ7B,SAAS;mBAAC;oBACT,QAAQ,EAAE,4BAA4B;oBACtC,QAAQ,EAAE;;GAET;oBACD,IAAI,EAAE;wBACJ,WAAW,EAAE,mBAAmB;wBAChC,SAAS,EAAE,SAAS;qBACrB;oBACD,aAAa,EAAE,iBAAiB,CAAC,IAAI;oBACrC,eAAe,EAAE,uBAAuB,CAAC,MAAM;iBAChD","sourcesContent":["import {\n Component,\n ChangeDetectionStrategy,\n computed,\n input,\n inject,\n ViewEncapsulation,\n} from '@angular/core';\nimport { cn } from '@semantic-components/ui';\nimport { SC_EDITOR } from './editor';\n\n@Component({\n selector: 'span[sc-editor-word-count]',\n template: `\n {{ wordCount() }} words\n `,\n host: {\n 'data-slot': 'editor-word-count',\n '[class]': 'class()',\n },\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ScEditorWordCount {\n readonly editor = inject(SC_EDITOR);\n readonly classInput = input<string>('', { alias: 'class' });\n\n protected readonly class = computed(() => cn('', this.classInput()));\n\n protected readonly wordCount = computed(() => {\n const text = this.getPlainText().trim();\n if (!text) return 0;\n return text.split(/\\s+/).filter(Boolean).length;\n });\n\n private getPlainText(): string {\n const editorInstance = this.editor.editorInstance();\n if (editorInstance) {\n return editorInstance.getText();\n }\n return this.editor.contentElement()?.textContent || '';\n }\n}\n"]}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { Directive, InjectionToken, input, signal } from '@angular/core';
|
|
2
|
+
import { Editor } from '@tiptap/core';
|
|
3
|
+
import Placeholder from '@tiptap/extension-placeholder';
|
|
4
|
+
import TextAlign from '@tiptap/extension-text-align';
|
|
5
|
+
import StarterKit from '@tiptap/starter-kit';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
export const SC_EDITOR = new InjectionToken('SC_EDITOR');
|
|
8
|
+
export class ScEditor {
|
|
9
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
|
|
10
|
+
readonly = input(false, ...(ngDevMode ? [{ debugName: "readonly" }] : []));
|
|
11
|
+
// State signals
|
|
12
|
+
isBold = signal(false, ...(ngDevMode ? [{ debugName: "isBold" }] : []));
|
|
13
|
+
isItalic = signal(false, ...(ngDevMode ? [{ debugName: "isItalic" }] : []));
|
|
14
|
+
isUnderline = signal(false, ...(ngDevMode ? [{ debugName: "isUnderline" }] : []));
|
|
15
|
+
isStrikethrough = signal(false, ...(ngDevMode ? [{ debugName: "isStrikethrough" }] : []));
|
|
16
|
+
isOrderedList = signal(false, ...(ngDevMode ? [{ debugName: "isOrderedList" }] : []));
|
|
17
|
+
isUnorderedList = signal(false, ...(ngDevMode ? [{ debugName: "isUnorderedList" }] : []));
|
|
18
|
+
isBlockquote = signal(false, ...(ngDevMode ? [{ debugName: "isBlockquote" }] : []));
|
|
19
|
+
alignment = signal('left', ...(ngDevMode ? [{ debugName: "alignment" }] : []));
|
|
20
|
+
currentHeading = signal('p', ...(ngDevMode ? [{ debugName: "currentHeading" }] : []));
|
|
21
|
+
canUndo = signal(false, ...(ngDevMode ? [{ debugName: "canUndo" }] : []));
|
|
22
|
+
canRedo = signal(false, ...(ngDevMode ? [{ debugName: "canRedo" }] : []));
|
|
23
|
+
// Reference to content element
|
|
24
|
+
contentElement = signal(null, ...(ngDevMode ? [{ debugName: "contentElement" }] : []));
|
|
25
|
+
// Tiptap editor instance
|
|
26
|
+
editorInstance = signal(null, ...(ngDevMode ? [{ debugName: "editorInstance" }] : []));
|
|
27
|
+
// Initialize Tiptap editor
|
|
28
|
+
initializeEditor(element, initialContent, placeholder = 'Start typing...') {
|
|
29
|
+
const editor = new Editor({
|
|
30
|
+
element,
|
|
31
|
+
extensions: [
|
|
32
|
+
StarterKit.configure({
|
|
33
|
+
link: {
|
|
34
|
+
openOnClick: false,
|
|
35
|
+
HTMLAttributes: {
|
|
36
|
+
target: '_blank',
|
|
37
|
+
rel: 'noopener noreferrer',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
}),
|
|
41
|
+
TextAlign.configure({
|
|
42
|
+
types: ['heading', 'paragraph'],
|
|
43
|
+
}),
|
|
44
|
+
Placeholder.configure({
|
|
45
|
+
placeholder,
|
|
46
|
+
}),
|
|
47
|
+
],
|
|
48
|
+
content: initialContent,
|
|
49
|
+
editable: !this.disabled() && !this.readonly(),
|
|
50
|
+
onUpdate: () => {
|
|
51
|
+
this.updateToolbarState();
|
|
52
|
+
},
|
|
53
|
+
onSelectionUpdate: () => {
|
|
54
|
+
this.updateToolbarState();
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
this.editorInstance.set(editor);
|
|
58
|
+
this.contentElement.set(element);
|
|
59
|
+
}
|
|
60
|
+
// Execute a formatting command
|
|
61
|
+
execCommand(command, value) {
|
|
62
|
+
if (this.disabled() || this.readonly())
|
|
63
|
+
return;
|
|
64
|
+
const editor = this.editorInstance();
|
|
65
|
+
if (!editor)
|
|
66
|
+
return;
|
|
67
|
+
editor.chain().focus();
|
|
68
|
+
switch (command) {
|
|
69
|
+
case 'bold':
|
|
70
|
+
editor.chain().focus().toggleBold().run();
|
|
71
|
+
break;
|
|
72
|
+
case 'italic':
|
|
73
|
+
editor.chain().focus().toggleItalic().run();
|
|
74
|
+
break;
|
|
75
|
+
case 'underline':
|
|
76
|
+
editor.chain().focus().toggleUnderline().run();
|
|
77
|
+
break;
|
|
78
|
+
case 'strikethrough':
|
|
79
|
+
editor.chain().focus().toggleStrike().run();
|
|
80
|
+
break;
|
|
81
|
+
case 'insertUnorderedList':
|
|
82
|
+
editor.chain().focus().toggleBulletList().run();
|
|
83
|
+
break;
|
|
84
|
+
case 'insertOrderedList':
|
|
85
|
+
editor.chain().focus().toggleOrderedList().run();
|
|
86
|
+
break;
|
|
87
|
+
case 'justifyLeft':
|
|
88
|
+
editor.chain().focus().setTextAlign('left').run();
|
|
89
|
+
break;
|
|
90
|
+
case 'justifyCenter':
|
|
91
|
+
editor.chain().focus().setTextAlign('center').run();
|
|
92
|
+
break;
|
|
93
|
+
case 'justifyRight':
|
|
94
|
+
editor.chain().focus().setTextAlign('right').run();
|
|
95
|
+
break;
|
|
96
|
+
case 'justifyFull':
|
|
97
|
+
editor.chain().focus().setTextAlign('justify').run();
|
|
98
|
+
break;
|
|
99
|
+
case 'formatBlock':
|
|
100
|
+
if (value === 'blockquote') {
|
|
101
|
+
editor.chain().focus().toggleBlockquote().run();
|
|
102
|
+
}
|
|
103
|
+
else if (value && value !== 'p') {
|
|
104
|
+
const level = parseInt(value.replace('h', ''));
|
|
105
|
+
editor.chain().focus().setHeading({ level }).run();
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
editor.chain().focus().setParagraph().run();
|
|
109
|
+
}
|
|
110
|
+
break;
|
|
111
|
+
case 'createLink':
|
|
112
|
+
if (value) {
|
|
113
|
+
editor.chain().focus().setLink({ href: value }).run();
|
|
114
|
+
}
|
|
115
|
+
break;
|
|
116
|
+
case 'insertHTML':
|
|
117
|
+
if (value) {
|
|
118
|
+
editor.chain().focus().insertContent(value).run();
|
|
119
|
+
}
|
|
120
|
+
break;
|
|
121
|
+
case 'insertHorizontalRule':
|
|
122
|
+
editor.chain().focus().setHorizontalRule().run();
|
|
123
|
+
break;
|
|
124
|
+
case 'removeFormat':
|
|
125
|
+
editor.chain().focus().clearNodes().unsetAllMarks().run();
|
|
126
|
+
break;
|
|
127
|
+
case 'undo':
|
|
128
|
+
editor.chain().focus().undo().run();
|
|
129
|
+
break;
|
|
130
|
+
case 'redo':
|
|
131
|
+
editor.chain().focus().redo().run();
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
// Destroy editor
|
|
136
|
+
destroyEditor() {
|
|
137
|
+
this.editorInstance()?.destroy();
|
|
138
|
+
this.editorInstance.set(null);
|
|
139
|
+
}
|
|
140
|
+
// Update toolbar state based on current selection
|
|
141
|
+
updateToolbarState() {
|
|
142
|
+
const editor = this.editorInstance();
|
|
143
|
+
if (!editor)
|
|
144
|
+
return;
|
|
145
|
+
this.isBold.set(editor.isActive('bold'));
|
|
146
|
+
this.isItalic.set(editor.isActive('italic'));
|
|
147
|
+
this.isUnderline.set(editor.isActive('underline'));
|
|
148
|
+
this.isStrikethrough.set(editor.isActive('strike'));
|
|
149
|
+
this.isOrderedList.set(editor.isActive('orderedList'));
|
|
150
|
+
this.isUnorderedList.set(editor.isActive('bulletList'));
|
|
151
|
+
this.isBlockquote.set(editor.isActive('blockquote'));
|
|
152
|
+
// Check alignment
|
|
153
|
+
if (editor.isActive({ textAlign: 'left' })) {
|
|
154
|
+
this.alignment.set('left');
|
|
155
|
+
}
|
|
156
|
+
else if (editor.isActive({ textAlign: 'center' })) {
|
|
157
|
+
this.alignment.set('center');
|
|
158
|
+
}
|
|
159
|
+
else if (editor.isActive({ textAlign: 'right' })) {
|
|
160
|
+
this.alignment.set('right');
|
|
161
|
+
}
|
|
162
|
+
else if (editor.isActive({ textAlign: 'justify' })) {
|
|
163
|
+
this.alignment.set('justify');
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
this.alignment.set('left'); // default
|
|
167
|
+
}
|
|
168
|
+
// Check heading level
|
|
169
|
+
for (let level = 1; level <= 6; level++) {
|
|
170
|
+
if (editor.isActive('heading', { level })) {
|
|
171
|
+
this.currentHeading.set(`h${level}`);
|
|
172
|
+
this.canUndo.set(editor.can().undo());
|
|
173
|
+
this.canRedo.set(editor.can().redo());
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
this.currentHeading.set('p');
|
|
178
|
+
// Check undo/redo availability
|
|
179
|
+
this.canUndo.set(editor.can().undo());
|
|
180
|
+
this.canRedo.set(editor.can().redo());
|
|
181
|
+
}
|
|
182
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: ScEditor, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
183
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.4", type: ScEditor, isStandalone: true, selector: "[sc-editor]", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "editor" }, properties: { "attr.data-disabled": "disabled() || null" } }, providers: [{ provide: SC_EDITOR, useExisting: ScEditor }], exportAs: ["scEditor"], ngImport: i0 });
|
|
184
|
+
}
|
|
185
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: ScEditor, decorators: [{
|
|
186
|
+
type: Directive,
|
|
187
|
+
args: [{
|
|
188
|
+
selector: '[sc-editor]',
|
|
189
|
+
exportAs: 'scEditor',
|
|
190
|
+
providers: [{ provide: SC_EDITOR, useExisting: ScEditor }],
|
|
191
|
+
host: {
|
|
192
|
+
'data-slot': 'editor',
|
|
193
|
+
'[attr.data-disabled]': 'disabled() || null',
|
|
194
|
+
},
|
|
195
|
+
}]
|
|
196
|
+
}], propDecorators: { disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }] } });
|
|
197
|
+
//# sourceMappingURL=editor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor.js","sourceRoot":"","sources":["../../../../../../../libs/editor/src/lib/components/editor/editor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,WAAW,MAAM,+BAA+B,CAAC;AACxD,OAAO,SAAS,MAAM,8BAA8B,CAAC;AACrD,OAAO,UAAU,MAAM,qBAAqB,CAAC;;AAK7C,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,cAAc,CAAW,WAAW,CAAC,CAAC;AAWnE,MAAM,OAAO,QAAQ;IAC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Q,EAAE,UAAU;oBACpB,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,UAAU,EAAE,CAAC;oBAC1D,IAAI,EAAE;wBACJ,WAAW,EAAE,QAAQ;wBACrB,sBAAsB,EAAE,oBAAoB;qBAC7C;iBACF","sourcesContent":["import { Directive, InjectionToken, input, signal } from '@angular/core';\nimport { Editor } from '@tiptap/core';\nimport Placeholder from '@tiptap/extension-placeholder';\nimport TextAlign from '@tiptap/extension-text-align';\nimport StarterKit from '@tiptap/starter-kit';\n\nexport type ScEditorAlignment = 'left' | 'center' | 'right' | 'justify';\nexport type ScEditorHeading = 'p' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n\nexport const SC_EDITOR = new InjectionToken<ScEditor>('SC_EDITOR');\n\n@Directive({\n selector: '[sc-editor]',\n exportAs: 'scEditor',\n providers: [{ provide: SC_EDITOR, useExisting: ScEditor }],\n host: {\n 'data-slot': 'editor',\n '[attr.data-disabled]': 'disabled() || null',\n },\n})\nexport class ScEditor {\n readonly disabled = input<boolean>(false);\n readonly readonly = input<boolean>(false);\n\n // State signals\n readonly isBold = signal(false);\n readonly isItalic = signal(false);\n readonly isUnderline = signal(false);\n readonly isStrikethrough = signal(false);\n readonly isOrderedList = signal(false);\n readonly isUnorderedList = signal(false);\n readonly isBlockquote = signal(false);\n readonly alignment = signal<ScEditorAlignment>('left');\n readonly currentHeading = signal<ScEditorHeading>('p');\n readonly canUndo = signal(false);\n readonly canRedo = signal(false);\n\n // Reference to content element\n readonly contentElement = signal<HTMLElement | null>(null);\n\n // Tiptap editor instance\n readonly editorInstance = signal<Editor | null>(null);\n\n // Initialize Tiptap editor\n initializeEditor(\n element: HTMLElement,\n initialContent: string,\n placeholder = 'Start typing...',\n ): void {\n const editor = new Editor({\n element,\n extensions: [\n StarterKit.configure({\n link: {\n openOnClick: false,\n HTMLAttributes: {\n target: '_blank',\n rel: 'noopener noreferrer',\n },\n },\n }),\n TextAlign.configure({\n types: ['heading', 'paragraph'],\n }),\n Placeholder.configure({\n placeholder,\n }),\n ],\n content: initialContent,\n editable: !this.disabled() && !this.readonly(),\n onUpdate: () => {\n this.updateToolbarState();\n },\n onSelectionUpdate: () => {\n this.updateToolbarState();\n },\n });\n\n this.editorInstance.set(editor);\n this.contentElement.set(element);\n }\n\n // Execute a formatting command\n execCommand(command: string, value?: string): void {\n if (this.disabled() || this.readonly()) return;\n\n const editor = this.editorInstance();\n if (!editor) return;\n\n editor.chain().focus();\n\n switch (command) {\n case 'bold':\n editor.chain().focus().toggleBold().run();\n break;\n case 'italic':\n editor.chain().focus().toggleItalic().run();\n break;\n case 'underline':\n editor.chain().focus().toggleUnderline().run();\n break;\n case 'strikethrough':\n editor.chain().focus().toggleStrike().run();\n break;\n case 'insertUnorderedList':\n editor.chain().focus().toggleBulletList().run();\n break;\n case 'insertOrderedList':\n editor.chain().focus().toggleOrderedList().run();\n break;\n case 'justifyLeft':\n editor.chain().focus().setTextAlign('left').run();\n break;\n case 'justifyCenter':\n editor.chain().focus().setTextAlign('center').run();\n break;\n case 'justifyRight':\n editor.chain().focus().setTextAlign('right').run();\n break;\n case 'justifyFull':\n editor.chain().focus().setTextAlign('justify').run();\n break;\n case 'formatBlock':\n if (value === 'blockquote') {\n editor.chain().focus().toggleBlockquote().run();\n } else if (value && value !== 'p') {\n const level = parseInt(value.replace('h', '')) as\n | 1\n | 2\n | 3\n | 4\n | 5\n | 6;\n editor.chain().focus().setHeading({ level }).run();\n } else {\n editor.chain().focus().setParagraph().run();\n }\n break;\n case 'createLink':\n if (value) {\n editor.chain().focus().setLink({ href: value }).run();\n }\n break;\n case 'insertHTML':\n if (value) {\n editor.chain().focus().insertContent(value).run();\n }\n break;\n case 'insertHorizontalRule':\n editor.chain().focus().setHorizontalRule().run();\n break;\n case 'removeFormat':\n editor.chain().focus().clearNodes().unsetAllMarks().run();\n break;\n case 'undo':\n editor.chain().focus().undo().run();\n break;\n case 'redo':\n editor.chain().focus().redo().run();\n break;\n }\n }\n\n // Destroy editor\n destroyEditor(): void {\n this.editorInstance()?.destroy();\n this.editorInstance.set(null);\n }\n\n // Update toolbar state based on current selection\n updateToolbarState(): void {\n const editor = this.editorInstance();\n if (!editor) return;\n\n this.isBold.set(editor.isActive('bold'));\n this.isItalic.set(editor.isActive('italic'));\n this.isUnderline.set(editor.isActive('underline'));\n this.isStrikethrough.set(editor.isActive('strike'));\n this.isOrderedList.set(editor.isActive('orderedList'));\n this.isUnorderedList.set(editor.isActive('bulletList'));\n this.isBlockquote.set(editor.isActive('blockquote'));\n\n // Check alignment\n if (editor.isActive({ textAlign: 'left' })) {\n this.alignment.set('left');\n } else if (editor.isActive({ textAlign: 'center' })) {\n this.alignment.set('center');\n } else if (editor.isActive({ textAlign: 'right' })) {\n this.alignment.set('right');\n } else if (editor.isActive({ textAlign: 'justify' })) {\n this.alignment.set('justify');\n } else {\n this.alignment.set('left'); // default\n }\n\n // Check heading level\n for (let level = 1; level <= 6; level++) {\n if (editor.isActive('heading', { level })) {\n this.currentHeading.set(`h${level}` as ScEditorHeading);\n this.canUndo.set(editor.can().undo());\n this.canRedo.set(editor.can().redo());\n return;\n }\n }\n this.currentHeading.set('p');\n\n // Check undo/redo availability\n this.canUndo.set(editor.can().undo());\n this.canRedo.set(editor.can().redo());\n }\n}\n"]}
|
|
@@ -1,45 +1,38 @@
|
|
|
1
1
|
// Root directive
|
|
2
2
|
export * from './editor';
|
|
3
|
-
|
|
4
3
|
// Content component
|
|
5
4
|
export * from './editor-content';
|
|
6
|
-
|
|
7
5
|
// Container components
|
|
8
6
|
export * from './editor-toolbar';
|
|
9
7
|
export * from './editor-toolbar-group';
|
|
10
8
|
export * from './editor-header';
|
|
11
9
|
export * from './editor-footer';
|
|
12
10
|
export * from './editor-separator';
|
|
13
|
-
|
|
14
11
|
// Formatting buttons
|
|
15
12
|
export * from './editor-bold-button';
|
|
16
13
|
export * from './editor-italic-button';
|
|
17
14
|
export * from './editor-underline-button';
|
|
18
15
|
export * from './editor-strikethrough-button';
|
|
19
|
-
|
|
20
16
|
// History buttons
|
|
21
17
|
export * from './editor-undo-button';
|
|
22
18
|
export * from './editor-redo-button';
|
|
23
|
-
|
|
24
19
|
// Alignment buttons
|
|
25
20
|
export * from './editor-align-left-button';
|
|
26
21
|
export * from './editor-align-center-button';
|
|
27
22
|
export * from './editor-align-right-button';
|
|
28
23
|
export * from './editor-align-justify-button';
|
|
29
|
-
|
|
30
24
|
// List buttons
|
|
31
25
|
export * from './editor-bullet-list-button';
|
|
32
26
|
export * from './editor-numbered-list-button';
|
|
33
|
-
|
|
34
27
|
// Content buttons
|
|
35
28
|
export * from './editor-link-button';
|
|
36
29
|
export * from './editor-blockquote-button';
|
|
37
30
|
export * from './editor-code-button';
|
|
38
31
|
export * from './editor-horizontal-rule-button';
|
|
39
32
|
export * from './editor-clear-formatting-button';
|
|
40
|
-
|
|
41
33
|
// Utility components
|
|
42
34
|
export * from './editor-heading-select';
|
|
43
35
|
export * from './editor-count';
|
|
44
36
|
export * from './editor-word-count';
|
|
45
37
|
export * from './editor-char-count';
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../libs/editor/src/lib/components/editor/index.ts"],"names":[],"mappings":"AAAA,iBAAiB;AACjB,cAAc,UAAU,CAAC;AAEzB,oBAAoB;AACpB,cAAc,kBAAkB,CAAC;AAEjC,uBAAuB;AACvB,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AAEnC,qBAAqB;AACrB,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAE9C,kBAAkB;AAClB,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AAErC,oBAAoB;AACpB,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAE9C,eAAe;AACf,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAE9C,kBAAkB;AAClB,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AAEjD,qBAAqB;AACrB,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC","sourcesContent":["// Root directive\nexport * from './editor';\n\n// Content component\nexport * from './editor-content';\n\n// Container components\nexport * from './editor-toolbar';\nexport * from './editor-toolbar-group';\nexport * from './editor-header';\nexport * from './editor-footer';\nexport * from './editor-separator';\n\n// Formatting buttons\nexport * from './editor-bold-button';\nexport * from './editor-italic-button';\nexport * from './editor-underline-button';\nexport * from './editor-strikethrough-button';\n\n// History buttons\nexport * from './editor-undo-button';\nexport * from './editor-redo-button';\n\n// Alignment buttons\nexport * from './editor-align-left-button';\nexport * from './editor-align-center-button';\nexport * from './editor-align-right-button';\nexport * from './editor-align-justify-button';\n\n// List buttons\nexport * from './editor-bullet-list-button';\nexport * from './editor-numbered-list-button';\n\n// Content buttons\nexport * from './editor-link-button';\nexport * from './editor-blockquote-button';\nexport * from './editor-code-button';\nexport * from './editor-horizontal-rule-button';\nexport * from './editor-clear-formatting-button';\n\n// Utility components\nexport * from './editor-heading-select';\nexport * from './editor-count';\nexport * from './editor-word-count';\nexport * from './editor-char-count';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/editor/src/lib/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC","sourcesContent":["export * from './editor';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semantic-components-editor.js","sourceRoot":"","sources":["../../../../libs/editor/src/semantic-components-editor.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,SAAS,CAAC","sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class ScEditorAlignCenterButton {
|
|
3
|
+
readonly editor: import("@semantic-components/editor").ScEditor;
|
|
4
|
+
readonly classInput: import("@angular/core").InputSignal<string>;
|
|
5
|
+
protected readonly class: import("@angular/core").Signal<string>;
|
|
6
|
+
onClick(): void;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ScEditorAlignCenterButton, never>;
|
|
8
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ScEditorAlignCenterButton, "button[sc-editor-align-center]", never, { "classInput": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class ScEditorAlignJustifyButton {
|
|
3
|
+
readonly editor: import("@semantic-components/editor").ScEditor;
|
|
4
|
+
readonly classInput: import("@angular/core").InputSignal<string>;
|
|
5
|
+
protected readonly class: import("@angular/core").Signal<string>;
|
|
6
|
+
onClick(): void;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ScEditorAlignJustifyButton, never>;
|
|
8
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ScEditorAlignJustifyButton, "button[sc-editor-align-justify]", never, { "classInput": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class ScEditorAlignLeftButton {
|
|
3
|
+
readonly editor: import("@semantic-components/editor").ScEditor;
|
|
4
|
+
readonly classInput: import("@angular/core").InputSignal<string>;
|
|
5
|
+
protected readonly class: import("@angular/core").Signal<string>;
|
|
6
|
+
onClick(): void;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ScEditorAlignLeftButton, never>;
|
|
8
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ScEditorAlignLeftButton, "button[sc-editor-align-left]", never, { "classInput": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class ScEditorAlignRightButton {
|
|
3
|
+
readonly editor: import("@semantic-components/editor").ScEditor;
|
|
4
|
+
readonly classInput: import("@angular/core").InputSignal<string>;
|
|
5
|
+
protected readonly class: import("@angular/core").Signal<string>;
|
|
6
|
+
onClick(): void;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ScEditorAlignRightButton, never>;
|
|
8
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ScEditorAlignRightButton, "button[sc-editor-align-right]", never, { "classInput": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class ScEditorBlockquoteButton {
|
|
3
|
+
readonly editor: import("@semantic-components/editor").ScEditor;
|
|
4
|
+
readonly classInput: import("@angular/core").InputSignal<string>;
|
|
5
|
+
protected readonly class: import("@angular/core").Signal<string>;
|
|
6
|
+
onClick(): void;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ScEditorBlockquoteButton, never>;
|
|
8
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ScEditorBlockquoteButton, "button[sc-editor-blockquote]", never, { "classInput": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class ScEditorBoldButton {
|
|
3
|
+
readonly editor: import("@semantic-components/editor").ScEditor;
|
|
4
|
+
readonly classInput: import("@angular/core").InputSignal<string>;
|
|
5
|
+
protected readonly class: import("@angular/core").Signal<string>;
|
|
6
|
+
onClick(): void;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ScEditorBoldButton, never>;
|
|
8
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ScEditorBoldButton, "button[sc-editor-bold]", never, { "classInput": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class ScEditorBulletListButton {
|
|
3
|
+
readonly editor: import("@semantic-components/editor").ScEditor;
|
|
4
|
+
readonly classInput: import("@angular/core").InputSignal<string>;
|
|
5
|
+
protected readonly class: import("@angular/core").Signal<string>;
|
|
6
|
+
onClick(): void;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ScEditorBulletListButton, never>;
|
|
8
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ScEditorBulletListButton, "button[sc-editor-bullet-list]", never, { "classInput": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class ScEditorCharCount {
|
|
3
|
+
readonly editor: import("@semantic-components/editor").ScEditor;
|
|
4
|
+
readonly classInput: import("@angular/core").InputSignal<string>;
|
|
5
|
+
protected readonly class: import("@angular/core").Signal<string>;
|
|
6
|
+
protected readonly charCount: import("@angular/core").Signal<number>;
|
|
7
|
+
private getPlainText;
|
|
8
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ScEditorCharCount, never>;
|
|
9
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ScEditorCharCount, "span[sc-editor-char-count]", never, { "classInput": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class ScEditorClearFormattingButton {
|
|
3
|
+
readonly editor: import("@semantic-components/editor").ScEditor;
|
|
4
|
+
readonly classInput: import("@angular/core").InputSignal<string>;
|
|
5
|
+
protected readonly class: import("@angular/core").Signal<string>;
|
|
6
|
+
onClick(): void;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ScEditorClearFormattingButton, never>;
|
|
8
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ScEditorClearFormattingButton, "button[sc-editor-clear-formatting]", never, { "classInput": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class ScEditorCodeButton {
|
|
3
|
+
readonly editor: import("@semantic-components/editor").ScEditor;
|
|
4
|
+
readonly classInput: import("@angular/core").InputSignal<string>;
|
|
5
|
+
protected readonly class: import("@angular/core").Signal<string>;
|
|
6
|
+
onClick(): void;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ScEditorCodeButton, never>;
|
|
8
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ScEditorCodeButton, "button[sc-editor-code]", never, { "classInput": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class ScEditorContent {
|
|
3
|
+
readonly editor: import("@semantic-components/editor").ScEditor;
|
|
4
|
+
private readonly elementRef;
|
|
5
|
+
private readonly destroyRef;
|
|
6
|
+
readonly value: import("@angular/core").ModelSignal<string>;
|
|
7
|
+
readonly placeholder: import("@angular/core").InputSignal<string>;
|
|
8
|
+
readonly ariaLabel: import("@angular/core").InputSignal<string>;
|
|
9
|
+
readonly classInput: import("@angular/core").InputSignal<string>;
|
|
10
|
+
readonly focus: import("@angular/core").OutputEmitterRef<void>;
|
|
11
|
+
readonly blur: import("@angular/core").OutputEmitterRef<void>;
|
|
12
|
+
private readonly isFocused;
|
|
13
|
+
private isInitialized;
|
|
14
|
+
protected readonly class: import("@angular/core").Signal<string>;
|
|
15
|
+
constructor();
|
|
16
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ScEditorContent, never>;
|
|
17
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ScEditorContent, "div[sc-editor-content]", never, { "value": { "alias": "value"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "classInput": { "alias": "class"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "focus": "focus"; "blur": "blur"; }, never, never, true, never>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class ScEditorCount {
|
|
3
|
+
readonly classInput: import("@angular/core").InputSignal<string>;
|
|
4
|
+
protected readonly class: import("@angular/core").Signal<string>;
|
|
5
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ScEditorCount, never>;
|
|
6
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ScEditorCount, "div[sc-editor-count]", never, { "classInput": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class ScEditorFooter {
|
|
3
|
+
readonly classInput: import("@angular/core").InputSignal<string>;
|
|
4
|
+
protected readonly class: import("@angular/core").Signal<string>;
|
|
5
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ScEditorFooter, never>;
|
|
6
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ScEditorFooter, "div[sc-editor-footer]", never, { "classInput": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class ScEditorHeader {
|
|
3
|
+
readonly classInput: import("@angular/core").InputSignal<string>;
|
|
4
|
+
protected readonly class: import("@angular/core").Signal<string>;
|
|
5
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ScEditorHeader, never>;
|
|
6
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ScEditorHeader, "div[sc-editor-header]", never, { "classInput": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class ScEditorHeadingSelect {
|
|
3
|
+
readonly editor: import("@semantic-components/editor").ScEditor;
|
|
4
|
+
readonly classInput: import("@angular/core").InputSignal<string>;
|
|
5
|
+
protected readonly class: import("@angular/core").Signal<string>;
|
|
6
|
+
onChange(event: Event): void;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ScEditorHeadingSelect, never>;
|
|
8
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ScEditorHeadingSelect, "select[sc-editor-heading]", never, { "classInput": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
9
|
+
}
|