@tmdjr/ngx-editor-js2-codemirror 0.0.7

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/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # NgxEditorJs2Codemirror
2
+
3
+ This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 19.1.0.
4
+
5
+ ## Code scaffolding
6
+
7
+ Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
8
+
9
+ ```bash
10
+ ng generate component component-name
11
+ ```
12
+
13
+ For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
14
+
15
+ ```bash
16
+ ng generate --help
17
+ ```
18
+
19
+ ## Building
20
+
21
+ To build the library, run:
22
+
23
+ ```bash
24
+ ng build ngx-editor-js2-codemirror
25
+ ```
26
+
27
+ This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
28
+
29
+ ### Publishing the Library
30
+
31
+ Once the project is built, you can publish your library by following these steps:
32
+
33
+ 1. Navigate to the `dist` directory:
34
+ ```bash
35
+ cd dist/ngx-editor-js2-codemirror
36
+ ```
37
+
38
+ 2. Run the `npm publish` command to publish your library to the npm registry:
39
+ ```bash
40
+ npm publish
41
+ ```
42
+
43
+ ## Running unit tests
44
+
45
+ To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
46
+
47
+ ```bash
48
+ ng test
49
+ ```
50
+
51
+ ## Running end-to-end tests
52
+
53
+ For end-to-end (e2e) testing, run:
54
+
55
+ ```bash
56
+ ng e2e
57
+ ```
58
+
59
+ Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
60
+
61
+ ## Additional Resources
62
+
63
+ For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
@@ -0,0 +1,89 @@
1
+ import * as i0 from '@angular/core';
2
+ import { input, signal, Component } from '@angular/core';
3
+ import * as i2 from '@angular/forms';
4
+ import { ReactiveFormsModule } from '@angular/forms';
5
+ import * as i1 from '@angular/cdk/drag-drop';
6
+ import { CdkDrag } from '@angular/cdk/drag-drop';
7
+ import * as i3 from '@ctrl/ngx-codemirror';
8
+ import { CodemirrorModule } from '@ctrl/ngx-codemirror';
9
+ import { ControlAccessorDirective, AutofocusDirective, ToolbarFabDirective } from '@tmdjr/ngx-editor-js2';
10
+ import { CommonModule } from '@angular/common';
11
+
12
+ class NgxEditorJs2CodemirrorComponent {
13
+ sortIndex = input(0);
14
+ componentInstanceName = 'NgxEditorJs2CodemirrorComponent';
15
+ autofocus = input(true);
16
+ formGroup = input.required();
17
+ formControlName = input.required();
18
+ blockOptionActions = input([
19
+ { action: 'text/typescript', icon: 'javascript' },
20
+ { action: 'css', icon: 'css' },
21
+ { action: 'xml', icon: 'html' },
22
+ ]);
23
+ codeMirrorOptions = signal({
24
+ lineNumbers: true,
25
+ theme: 'material-palenight',
26
+ mode: 'text/typescript',
27
+ extraKeys: { 'Ctrl-Space': 'autocomplete' },
28
+ });
29
+ savedAction = signal('display-large');
30
+ actionCallbackBind = this.actionCallback.bind(this);
31
+ actionCallback(action) {
32
+ this.codeMirrorOptions.update((prev) => ({ ...prev, mode: action }));
33
+ this.savedAction.update(() => action);
34
+ }
35
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NgxEditorJs2CodemirrorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
36
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.1.5", type: NgxEditorJs2CodemirrorComponent, isStandalone: true, selector: "ngx-editor-js2-codemirror", inputs: { sortIndex: { classPropertyName: "sortIndex", publicName: "sortIndex", isSignal: true, isRequired: false, transformFunction: null }, autofocus: { classPropertyName: "autofocus", publicName: "autofocus", isSignal: true, isRequired: false, transformFunction: null }, formGroup: { classPropertyName: "formGroup", publicName: "formGroup", isSignal: true, isRequired: true, transformFunction: null }, formControlName: { classPropertyName: "formControlName", publicName: "formControlName", isSignal: true, isRequired: true, transformFunction: null }, blockOptionActions: { classPropertyName: "blockOptionActions", publicName: "blockOptionActions", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "cdk-drag-animating" }, hostDirectives: [{ directive: i1.CdkDrag }], ngImport: i0, template: `
37
+ <ng-container [formGroup]="formGroup()">
38
+ <span
39
+ controlAccessor
40
+ [autofocus]="autofocus()"
41
+ ></span>
42
+ <ngx-codemirror
43
+ toolbarFab
44
+ [actionCallback]="actionCallbackBind"
45
+ [blockOptionActions]="blockOptionActions()"
46
+ [formControlName]="formControlName()"
47
+ [componentContextPositionIndex]="sortIndex()"
48
+ [options]="codeMirrorOptions()"
49
+ ></ngx-codemirror>
50
+ </ng-container>
51
+ `, isInline: true, styles: [":host{display:block;position:relative}:host .codemirror-container-overlay{display:flex;height:100%;width:100%;position:absolute}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: ControlAccessorDirective, selector: "[controlAccessor]", inputs: ["defaultValue"] }, { kind: "directive", type: AutofocusDirective, selector: "[autofocus]", inputs: ["autofocus"] }, { kind: "directive", type: ToolbarFabDirective, selector: "[toolbarFab]", inputs: ["autofocus", "blockOptionActions", "actionCallback", "componentContextPositionIndex", "formControlName"] }, { kind: "ngmodule", type: CodemirrorModule }, { kind: "component", type: i3.CodemirrorComponent, selector: "ngx-codemirror", inputs: ["className", "name", "autoFocus", "options", "preserveScrollPosition"], outputs: ["cursorActivity", "focusChange", "scroll", "drop", "codeMirrorLoaded"] }] });
52
+ }
53
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: NgxEditorJs2CodemirrorComponent, decorators: [{
54
+ type: Component,
55
+ args: [{ selector: 'ngx-editor-js2-codemirror', host: { class: 'cdk-drag-animating' }, hostDirectives: [CdkDrag], imports: [
56
+ CommonModule,
57
+ ReactiveFormsModule,
58
+ ControlAccessorDirective,
59
+ AutofocusDirective,
60
+ ToolbarFabDirective,
61
+ CodemirrorModule,
62
+ ], template: `
63
+ <ng-container [formGroup]="formGroup()">
64
+ <span
65
+ controlAccessor
66
+ [autofocus]="autofocus()"
67
+ ></span>
68
+ <ngx-codemirror
69
+ toolbarFab
70
+ [actionCallback]="actionCallbackBind"
71
+ [blockOptionActions]="blockOptionActions()"
72
+ [formControlName]="formControlName()"
73
+ [componentContextPositionIndex]="sortIndex()"
74
+ [options]="codeMirrorOptions()"
75
+ ></ngx-codemirror>
76
+ </ng-container>
77
+ `, styles: [":host{display:block;position:relative}:host .codemirror-container-overlay{display:flex;height:100%;width:100%;position:absolute}\n"] }]
78
+ }] });
79
+
80
+ /*
81
+ * Public API Surface of ngx-editor-js2-codemirror
82
+ */
83
+
84
+ /**
85
+ * Generated bundle index. Do not edit.
86
+ */
87
+
88
+ export { NgxEditorJs2CodemirrorComponent };
89
+ //# sourceMappingURL=tmdjr-ngx-editor-js2-codemirror.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tmdjr-ngx-editor-js2-codemirror.mjs","sources":["../../../projects/ngx-editor-js2-codemirror/src/lib/ngx-editor-js2-codemirror.component.ts","../../../projects/ngx-editor-js2-codemirror/src/public-api.ts","../../../projects/ngx-editor-js2-codemirror/src/tmdjr-ngx-editor-js2-codemirror.ts"],"sourcesContent":["import { Component, input, signal } from '@angular/core';\nimport { FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { CdkDrag } from '@angular/cdk/drag-drop';\nimport { CodemirrorModule } from '@ctrl/ngx-codemirror';\n\nimport {\n AutofocusDirective,\n BlockComponent,\n BlockOptionAction,\n ControlAccessorDirective,\n ToolbarFabDirective,\n} from '@tmdjr/ngx-editor-js2';\nimport { CommonModule } from '@angular/common';\n\n@Component({\n selector: 'ngx-editor-js2-codemirror',\n host: { class: 'cdk-drag-animating' },\n hostDirectives: [CdkDrag],\n imports: [\n CommonModule,\n ReactiveFormsModule,\n ControlAccessorDirective,\n AutofocusDirective,\n ToolbarFabDirective,\n CodemirrorModule,\n ],\n template: `\n <ng-container [formGroup]=\"formGroup()\">\n <span\n controlAccessor\n [autofocus]=\"autofocus()\"\n ></span>\n <ngx-codemirror\n toolbarFab\n [actionCallback]=\"actionCallbackBind\"\n [blockOptionActions]=\"blockOptionActions()\"\n [formControlName]=\"formControlName()\"\n [componentContextPositionIndex]=\"sortIndex()\"\n [options]=\"codeMirrorOptions()\"\n ></ngx-codemirror>\n </ng-container>\n `,\n styles: [\n `\n :host {\n display: block;\n position: relative;\n .codemirror-container-overlay {\n display: flex;\n height: 100%;\n width: 100%;\n position: absolute;\n }\n }\n `,\n ],\n})\nexport class NgxEditorJs2CodemirrorComponent implements BlockComponent {\n sortIndex = input<number>(0);\n componentInstanceName = 'NgxEditorJs2CodemirrorComponent';\n autofocus = input<boolean>(true);\n formGroup = input.required<FormGroup>();\n formControlName = input.required<string>();\n blockOptionActions = input<BlockOptionAction[]>([\n { action: 'text/typescript', icon: 'javascript' },\n { action: 'css', icon: 'css' },\n { action: 'xml', icon: 'html' },\n ]);\n\n codeMirrorOptions = signal({\n lineNumbers: true,\n theme: 'material-palenight',\n mode: 'text/typescript',\n extraKeys: { 'Ctrl-Space': 'autocomplete' },\n });\n\n savedAction = signal<string>('display-large');\n actionCallbackBind = this.actionCallback.bind(this);\n\n actionCallback(action: string) {\n this.codeMirrorOptions.update((prev) => ({ ...prev, mode: action }));\n this.savedAction.update(() => action);\n }\n}\n","/*\n * Public API Surface of ngx-editor-js2-codemirror\n */\n\nexport * from './lib/ngx-editor-js2-codemirror.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;MAyDa,+BAA+B,CAAA;AAC1C,IAAA,SAAS,GAAG,KAAK,CAAS,CAAC,CAAC;IAC5B,qBAAqB,GAAG,iCAAiC;AACzD,IAAA,SAAS,GAAG,KAAK,CAAU,IAAI,CAAC;AAChC,IAAA,SAAS,GAAG,KAAK,CAAC,QAAQ,EAAa;AACvC,IAAA,eAAe,GAAG,KAAK,CAAC,QAAQ,EAAU;IAC1C,kBAAkB,GAAG,KAAK,CAAsB;AAC9C,QAAA,EAAE,MAAM,EAAE,iBAAiB,EAAE,IAAI,EAAE,YAAY,EAAE;AACjD,QAAA,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE;AAC9B,QAAA,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE;AAChC,KAAA,CAAC;IAEF,iBAAiB,GAAG,MAAM,CAAC;AACzB,QAAA,WAAW,EAAE,IAAI;AACjB,QAAA,KAAK,EAAE,oBAAoB;AAC3B,QAAA,IAAI,EAAE,iBAAiB;AACvB,QAAA,SAAS,EAAE,EAAE,YAAY,EAAE,cAAc,EAAE;AAC5C,KAAA,CAAC;AAEF,IAAA,WAAW,GAAG,MAAM,CAAS,eAAe,CAAC;IAC7C,kBAAkB,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC;AAEnD,IAAA,cAAc,CAAC,MAAc,EAAA;QAC3B,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,MAAM,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;QACpE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,MAAM,CAAC;;uGAxB5B,+BAA+B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA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EAAA,CAAA,WAAA,EAAA,MAAA,EAAA,WAAA,EAAA,SAAA,EAAA,wBAAA,CAAA,EAAA,OAAA,EAAA,CAAA,gBAAA,EAAA,aAAA,EAAA,QAAA,EAAA,MAAA,EAAA,kBAAA,CAAA,EAAA,CAAA,EAAA,CAAA;;2FAiCP,+BAA+B,EAAA,UAAA,EAAA,CAAA;kBA3C3C,SAAS;+BACE,2BAA2B,EAAA,IAAA,EAC/B,EAAE,KAAK,EAAE,oBAAoB,EAAE,EACrB,cAAA,EAAA,CAAC,OAAO,CAAC,EAChB,OAAA,EAAA;wBACP,YAAY;wBACZ,mBAAmB;wBACnB,wBAAwB;wBACxB,kBAAkB;wBAClB,mBAAmB;wBACnB,gBAAgB;qBACjB,EACS,QAAA,EAAA;;;;;;;;;;;;;;;AAeT,EAAA,CAAA,EAAA,MAAA,EAAA,CAAA,oIAAA,CAAA,EAAA;;;ACzCH;;AAEG;;ACFH;;AAEG;;;;"}
package/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="@tmdjr/ngx-editor-js2-codemirror" />
5
+ export * from './public-api';
@@ -0,0 +1,25 @@
1
+ import { FormGroup } from '@angular/forms';
2
+ import { BlockComponent, BlockOptionAction } from '@tmdjr/ngx-editor-js2';
3
+ import * as i0 from "@angular/core";
4
+ import * as i1 from "@angular/cdk/drag-drop";
5
+ export declare class NgxEditorJs2CodemirrorComponent implements BlockComponent {
6
+ sortIndex: import("@angular/core").InputSignal<number>;
7
+ componentInstanceName: string;
8
+ autofocus: import("@angular/core").InputSignal<boolean>;
9
+ formGroup: import("@angular/core").InputSignal<FormGroup<any>>;
10
+ formControlName: import("@angular/core").InputSignal<string>;
11
+ blockOptionActions: import("@angular/core").InputSignal<BlockOptionAction[]>;
12
+ codeMirrorOptions: import("@angular/core").WritableSignal<{
13
+ lineNumbers: boolean;
14
+ theme: string;
15
+ mode: string;
16
+ extraKeys: {
17
+ 'Ctrl-Space': string;
18
+ };
19
+ }>;
20
+ savedAction: import("@angular/core").WritableSignal<string>;
21
+ actionCallbackBind: (action: string) => void;
22
+ actionCallback(action: string): void;
23
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxEditorJs2CodemirrorComponent, never>;
24
+ static ɵcmp: i0.ɵɵComponentDeclaration<NgxEditorJs2CodemirrorComponent, "ngx-editor-js2-codemirror", never, { "sortIndex": { "alias": "sortIndex"; "required": false; "isSignal": true; }; "autofocus": { "alias": "autofocus"; "required": false; "isSignal": true; }; "formGroup": { "alias": "formGroup"; "required": true; "isSignal": true; }; "formControlName": { "alias": "formControlName"; "required": true; "isSignal": true; }; "blockOptionActions": { "alias": "blockOptionActions"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.CdkDrag; inputs: {}; outputs: {}; }]>;
25
+ }
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@tmdjr/ngx-editor-js2-codemirror",
3
+ "version": "0.0.7",
4
+ "peerDependencies": {
5
+ "@angular/common": "^19.1.0",
6
+ "@angular/core": "^19.1.0"
7
+ },
8
+ "dependencies": {
9
+ "tslib": "^2.3.0"
10
+ },
11
+ "sideEffects": false,
12
+ "module": "fesm2022/tmdjr-ngx-editor-js2-codemirror.mjs",
13
+ "typings": "index.d.ts",
14
+ "exports": {
15
+ "./package.json": {
16
+ "default": "./package.json"
17
+ },
18
+ ".": {
19
+ "types": "./index.d.ts",
20
+ "default": "./fesm2022/tmdjr-ngx-editor-js2-codemirror.mjs"
21
+ }
22
+ }
23
+ }
@@ -0,0 +1 @@
1
+ export * from './lib/ngx-editor-js2-codemirror.component';