@viveeditor/angular 0.1.0 → 1.0.0-rc.1
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import { ChangeDetectionStrategy, Component, DestroyRef, ElementRef, afterNextRender, booleanAttribute, computed, effect, forwardRef, inject, input, output, signal } from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, DestroyRef, ElementRef, afterNextRender, booleanAttribute, computed, effect, forwardRef, inject, input, output, signal } from "@angular/core";
|
|
3
3
|
import { NG_VALUE_ACCESSOR } from "@angular/forms";
|
|
4
4
|
import { mountEditor } from "viveeditor";
|
|
5
5
|
var ViveEditorComponent = class ViveEditorComponent {
|
|
@@ -15,6 +15,7 @@ var ViveEditorComponent = class ViveEditorComponent {
|
|
|
15
15
|
editorFocus = output();
|
|
16
16
|
editorBlur = output();
|
|
17
17
|
#host = inject(ElementRef);
|
|
18
|
+
#changes = inject(ChangeDetectorRef);
|
|
18
19
|
#disabled = signal(false, ...ngDevMode ? [{ debugName: "#disabled" }] : /* istanbul ignore next */ []);
|
|
19
20
|
#editable = computed(() => !this.readonly() && !this.#disabled(), ...ngDevMode ? [{ debugName: "#editable" }] : /* istanbul ignore next */ []);
|
|
20
21
|
#mount = null;
|
|
@@ -37,11 +38,13 @@ var ViveEditorComponent = class ViveEditorComponent {
|
|
|
37
38
|
onChange: (html) => {
|
|
38
39
|
this.#value = html;
|
|
39
40
|
this.#onChange(html);
|
|
41
|
+
this.#changes.markForCheck();
|
|
40
42
|
},
|
|
41
43
|
onReady: (editor) => this.ready.emit(editor),
|
|
42
44
|
onFocus: (editor) => this.editorFocus.emit(editor),
|
|
43
45
|
onBlur: (editor) => {
|
|
44
46
|
this.#onTouched();
|
|
47
|
+
this.#changes.markForCheck();
|
|
45
48
|
this.editorBlur.emit(editor);
|
|
46
49
|
}
|
|
47
50
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viveeditor-angular.mjs","names":[],"sources":["../../src/editor.component.ts"],"sourcesContent":["import {\n afterNextRender,\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n DestroyRef,\n ElementRef,\n effect,\n forwardRef,\n type InputSignal,\n type InputSignalWithTransform,\n inject,\n input,\n type OutputEmitterRef,\n output,\n type Signal,\n signal,\n type WritableSignal,\n} from '@angular/core'\nimport { type ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'\nimport { type Editor, type EditorMount, type MountOptions, mountEditor } from 'viveeditor'\n\n@Component({\n selector: 'vive-ng-editor',\n template: '',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => ViveEditorComponent),\n multi: true,\n },\n ],\n})\nexport class ViveEditorComponent implements ControlValueAccessor {\n readonly extensions: InputSignal<MountOptions['extensions']> = input<MountOptions['extensions']>()\n readonly ui: InputSignal<MountOptions['ui']> = input<MountOptions['ui']>()\n readonly locale: InputSignal<string | undefined> = input<string>()\n readonly label: InputSignal<string | undefined> = input<string>()\n readonly readonly: InputSignalWithTransform<boolean, unknown> = input(false, {\n transform: booleanAttribute,\n })\n\n readonly ready: OutputEmitterRef<Editor> = output<Editor>()\n readonly editorFocus: OutputEmitterRef<Editor> = output<Editor>()\n readonly editorBlur: OutputEmitterRef<Editor> = output<Editor>()\n\n readonly #host: ElementRef<HTMLElement> = inject(ElementRef)\n readonly #disabled: WritableSignal<boolean> = signal(false)\n readonly #editable: Signal<boolean> = computed(() => !this.readonly() && !this.#disabled())\n #mount: EditorMount | null = null\n #value = ''\n #onChange: (html: string) => void = () => undefined\n #onTouched: () => void = () => undefined\n\n constructor() {\n afterNextRender(() => {\n const extensions = this.extensions()\n const ui = this.ui()\n const locale = this.locale()\n const label = this.label()\n this.#mount = mountEditor(this.#host.nativeElement, {\n value: this.#value,\n editable: this.#editable(),\n ...(extensions === undefined ? {} : { extensions }),\n ...(ui === undefined ? {} : { ui }),\n ...(locale === undefined ? {} : { locale }),\n ...(label === undefined ? {} : { label }),\n onChange: (html) => {\n this.#value = html\n this.#onChange(html)\n },\n onReady: (editor) => this.ready.emit(editor),\n onFocus: (editor) => this.editorFocus.emit(editor),\n onBlur: (editor) => {\n this.#onTouched()\n this.editorBlur.emit(editor)\n },\n })\n })\n effect(() => {\n const editable = this.#editable()\n this.#mount?.setEditable(editable)\n })\n inject(DestroyRef).onDestroy(() => {\n this.#mount?.destroy()\n this.#mount = null\n })\n }\n\n get editor(): Editor | null {\n return this.#mount?.editor ?? null\n }\n\n writeValue(value: unknown): void {\n this.#value = typeof value === 'string' ? value : ''\n this.#mount?.setValue(this.#value)\n }\n\n registerOnChange(fn: (html: string) => void): void {\n this.#onChange = fn\n }\n\n registerOnTouched(fn: () => void): void {\n this.#onTouched = fn\n }\n\n setDisabledState(disabled: boolean): void {\n this.#disabled.set(disabled)\n }\n}\n"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"viveeditor-angular.mjs","names":[],"sources":["../../src/editor.component.ts"],"sourcesContent":["import {\n afterNextRender,\n booleanAttribute,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n computed,\n DestroyRef,\n ElementRef,\n effect,\n forwardRef,\n type InputSignal,\n type InputSignalWithTransform,\n inject,\n input,\n type OutputEmitterRef,\n output,\n type Signal,\n signal,\n type WritableSignal,\n} from '@angular/core'\nimport { type ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'\nimport { type Editor, type EditorMount, type MountOptions, mountEditor } from 'viveeditor'\n\n@Component({\n selector: 'vive-ng-editor',\n template: '',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => ViveEditorComponent),\n multi: true,\n },\n ],\n})\nexport class ViveEditorComponent implements ControlValueAccessor {\n readonly extensions: InputSignal<MountOptions['extensions']> = input<MountOptions['extensions']>()\n readonly ui: InputSignal<MountOptions['ui']> = input<MountOptions['ui']>()\n readonly locale: InputSignal<string | undefined> = input<string>()\n readonly label: InputSignal<string | undefined> = input<string>()\n readonly readonly: InputSignalWithTransform<boolean, unknown> = input(false, {\n transform: booleanAttribute,\n })\n\n readonly ready: OutputEmitterRef<Editor> = output<Editor>()\n readonly editorFocus: OutputEmitterRef<Editor> = output<Editor>()\n readonly editorBlur: OutputEmitterRef<Editor> = output<Editor>()\n\n readonly #host: ElementRef<HTMLElement> = inject(ElementRef)\n readonly #changes: ChangeDetectorRef = inject(ChangeDetectorRef)\n readonly #disabled: WritableSignal<boolean> = signal(false)\n readonly #editable: Signal<boolean> = computed(() => !this.readonly() && !this.#disabled())\n #mount: EditorMount | null = null\n #value = ''\n #onChange: (html: string) => void = () => undefined\n #onTouched: () => void = () => undefined\n\n constructor() {\n afterNextRender(() => {\n const extensions = this.extensions()\n const ui = this.ui()\n const locale = this.locale()\n const label = this.label()\n this.#mount = mountEditor(this.#host.nativeElement, {\n value: this.#value,\n editable: this.#editable(),\n ...(extensions === undefined ? {} : { extensions }),\n ...(ui === undefined ? {} : { ui }),\n ...(locale === undefined ? {} : { locale }),\n ...(label === undefined ? {} : { label }),\n onChange: (html) => {\n this.#value = html\n this.#onChange(html)\n this.#changes.markForCheck()\n },\n onReady: (editor) => this.ready.emit(editor),\n onFocus: (editor) => this.editorFocus.emit(editor),\n onBlur: (editor) => {\n this.#onTouched()\n this.#changes.markForCheck()\n this.editorBlur.emit(editor)\n },\n })\n })\n effect(() => {\n const editable = this.#editable()\n this.#mount?.setEditable(editable)\n })\n inject(DestroyRef).onDestroy(() => {\n this.#mount?.destroy()\n this.#mount = null\n })\n }\n\n get editor(): Editor | null {\n return this.#mount?.editor ?? null\n }\n\n writeValue(value: unknown): void {\n this.#value = typeof value === 'string' ? value : ''\n this.#mount?.setValue(this.#value)\n }\n\n registerOnChange(fn: (html: string) => void): void {\n this.#onChange = fn\n }\n\n registerOnTouched(fn: () => void): void {\n this.#onTouched = fn\n }\n\n setDisabledState(disabled: boolean): void {\n this.#disabled.set(disabled)\n }\n}\n"],"mappings":";;;;AAoCA,IAAa,sBAAb,MAAa,oBAAmB;CACrB,aAAsD,MAAmC,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,aAAA,CAAA,+BAAA,CAAA,CAAA;CACzF,KAAsC,MAA2B,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,KAAA,CAAA,+BAAA,CAAA,CAAA;CACjE,SAA0C,MAAe,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CACzD,QAAyC,MAAe,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CACxD,WAAuD,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EACzE,WAAW;CAAgB,CAAA;CAGpB,QAAkC,OAAM;CACxC,cAAwC,OAAM;CAC9C,aAAuC,OAAM;CAE7C,QAAiC,OAAO,UAAU;CAClD,WAA8B,OAAO,iBAAiB;CACtD,YAAqC,OAAO,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAClD,YAA6B,eAAe,CAAC,KAAK,SAAQ,KAAM,CAAC,KAAK,UAAS,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAC3F,SAA6B;CAC7B,SAAS;CACT,kBAA0C;CAC1C,mBAA+B;CAE/B,cAAA;EACE,sBAAqB;GACnB,MAAM,aAAa,KAAK,WAAU;GAClC,MAAM,KAAK,KAAK,GAAE;GAClB,MAAM,SAAS,KAAK,OAAM;GAC1B,MAAM,QAAQ,KAAK,MAAK;GACxB,KAAK,SAAS,YAAY,KAAK,MAAM,eAAe;IAClD,OAAO,KAAK;IACZ,UAAU,KAAK,UAAS;IACxB,GAAI,eAAe,SAA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YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,IAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,QAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,OAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,UAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,SAAA;GAAA,OAAA;GAAA,aAAA;GAAA,YAAA;EAAA;EAAA,WARnB,CACT;GACE,SAAS;GACT,aAAa,iBAAiB,mBAAmB;GACjD,OAAO;EACR,CACF;EAAA,UAAA;EAAA,UARS;EAAE,UAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAUD,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAmB,YAAA,CAAA;EAZ/B,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,UAAU;GACV,iBAAiB,wBAAwB;GACzC,WAAW,CACT;IACE,SAAS;IACT,aAAa,iBAAgB,mBAAoB;IACjD,OAAO;GACR,CACF;EACF,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viveeditor/angular",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "1.0.0-rc.1",
|
|
4
4
|
"description": "Angular component for viveEditor with ngModel and reactive forms, toolbar and every feature included.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"ngmodel",
|
|
14
14
|
"reactive-forms"
|
|
15
15
|
],
|
|
16
|
-
"homepage": "https://
|
|
16
|
+
"homepage": "https://editor.vivepdf.com/en/docs/frameworks/",
|
|
17
17
|
"bugs": {
|
|
18
18
|
"url": "https://github.com/mtvrkan/viveeditor/issues"
|
|
19
19
|
},
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"type": "module",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"tslib": "^2.3.0",
|
|
28
|
-
"viveeditor": "^0.1
|
|
28
|
+
"viveeditor": "^1.0.0-rc.1"
|
|
29
29
|
},
|
|
30
30
|
"size-limit": [
|
|
31
31
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viveeditor-angular.d.ts","names":[],"sources":["../../src/editor.component.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"viveeditor-angular.d.ts","names":[],"sources":["../../src/editor.component.ts"],"mappings":";;;;qBAoCa,+BAA+B;;WACjC,YAAY,YAAY;WACxB,IAAI,YAAY;WAChB,QAAQ;WACR,OAAO;WACP,UAAU;WAIV,OAAO,iBAAiB;WACxB,aAAa,iBAAiB;WAC9B,YAAY,iBAAiB;;MAgDlC,UAAU;EAId,WAAW;EAKX,iBAAiB,KAAK;EAItB,kBAAkB;EAIlB,iBAAiB;SA5EN,MAAA,GAAA,qBAAA;SAAA,MAAA,GAAA,uBAAA;IAAmB;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;IAAA;MAAA;MAAA;MAAA;;;IAAA;IAAA;IAAA"}
|