Skip to content

Commit 7400f30

Browse files
iklimisbampakoa
authored andcommitted
feat: use the default html parser
1 parent 3caac76 commit 7400f30

File tree

5 files changed

+15
-18
lines changed

5 files changed

+15
-18
lines changed

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
"@angular/platform-browser": "~13.0.0",
2020
"@angular/platform-browser-dynamic": "~13.0.0",
2121
"@angular/router": "~13.0.0",
22+
"grapesjs": "^0.17.29",
23+
"grapesjs-preset-newsletter": "^0.2.21",
2224
"rxjs": "~7.4.0",
2325
"tslib": "^2.3.0",
24-
"zone.js": "~0.11.4",
25-
"grapesjs": "^0.17.29",
26-
"grapesjs-preset-newsletter": "^0.2.21"
26+
"zone.js": "~0.11.4"
2727
},
2828
"devDependencies": {
2929
"@angular-devkit/build-angular": "~13.0.4",

projects/ngx-grapesjs/src/lib/grapesjs.model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export interface Config {
5252
components: string;
5353
pluginsOpts: Record<string, any>;
5454
parser: {
55-
parserHtml: {};
55+
parserHtml: {}
5656
};
5757
}
5858

projects/ngx-grapesjs/src/lib/ngx-grapesjs.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Component, Input, OnInit } from '@angular/core';
2-
import { CommandSender, Config, GrapesJsEditor, TextAction, TextEditor } from './grapesjs.model';
32

3+
import { CommandSender, Config, GrapesJsEditor, TextAction, TextEditor } from './grapesjs.model';
44
import { NgxGrapesjsService } from './ngx-grapesjs.service';
55
import { Placeholder } from './placeholder.model';
66

@@ -39,7 +39,7 @@ export class NgxGrapesjsComponent implements OnInit {
3939

4040
ngOnInit(): void {
4141
// setup the default parser. It can be overriden by providing a custom implementation of the NgxGrapesjsService
42-
this.config.parser.parserHtml = this.ngxGrapesJsService.parserHtml;
42+
this.config.parser.parserHtml = this.ngxGrapesJsService?.parserHtml;
4343

4444
// initialize the editor
4545
this.editor = grapesjs.init(this.config);
@@ -95,11 +95,11 @@ export class NgxGrapesjsComponent implements OnInit {
9595
private undo = (editor: GrapesJsEditor, sender: CommandSender) => {
9696
sender.set('active', 0);
9797
editor.UndoManager?.undo(1);
98-
}
98+
};
9999

100100
private redo = (editor: GrapesJsEditor, sender: CommandSender) => {
101101
sender.set('active', 0);
102102
editor.UndoManager?.redo(1);
103-
}
103+
};
104104

105105
}

projects/ngx-grapesjs/src/lib/ngx-grapesjs.service.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ import { Injectable } from '@angular/core';
55
})
66
export class NgxGrapesjsService {
77

8-
parserHtml = (input: string) => {
9-
const parser = new DOMParser();
10-
return parser.parseFromString(input, 'text/html');
11-
};
8+
parserHtml = (input: string) => {};
129

1310
}

0 commit comments

Comments
 (0)