Skip to content

Commit 523f26e

Browse files
committed
added image_editor config option
1 parent 84be4ae commit 523f26e

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

src/App/Editor/EditorConfig.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@ class EditorConfig extends EditorBaseClass
1919

2020
function __construct(){
2121
$this->exposeApi = config('grapesjs.expose_api', false);
22+
$this->imageEditor = config('grapesjs.image_editor', false);
2223
}
2324
}

src/config.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
return [
44
'expose_api' => false,
5+
'image_editor' => false,
56
'styles' => [],
67
'scripts' => []
78
];

src/public/vendor/grapesjs/editor.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/resources/js/gjs/gjs.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,22 @@ const toastr = require('toastr');
1010
let config = window.editorConfig;
1111
delete window.editorConfig;
1212

13-
config.plugins = [
13+
14+
let remoteIcons = 'https://cdnjs.cloudflare.com/ajax/libs/tui-image-editor/3.15.0/svg/'
15+
16+
let plugins = [
1417
pluginBlocks,
1518
// bootstrap4,
16-
tUIImageEditor,
17-
];
19+
]
1820

19-
let remoteIcons = 'https://cdnjs.cloudflare.com/ajax/libs/tui-image-editor/3.15.0/svg/'
20-
config.pluginsOpts = {
21+
let pluginsOpts = {
2122
'grapesjs-blocks-basic': {},
2223
// 'grapesjs-blocks-bootstrap4': {},
23-
[tUIImageEditor]: {
24+
};
25+
26+
if(config.imageEditor){
27+
plugins.push(tUIImageEditor)
28+
pluginsOpts[tUIImageEditor] = {
2429
config: {
2530
includeUI: {
2631
initMenu: 'filter',
@@ -34,8 +39,11 @@ config.pluginsOpts = {
3439
'submenu.normalIcon.path': `${remoteIcons}icon-d.svg`,
3540
'submenu.activeIcon.path': `${remoteIcons}icon-c.svg`,
3641
},
37-
},
38-
};
42+
}
43+
}
44+
45+
config.plugins = plugins
46+
config.pluginsOpts = pluginsOpts
3947

4048
let editor = grapesjs.init(config);
4149

0 commit comments

Comments
 (0)