Skip to content

Commit e3d1a94

Browse files
committed
feat: add postcss, flexbox and code-editor plugins, fix the container styles
1 parent 42b170c commit e3d1a94

File tree

9 files changed

+42
-8
lines changed

9 files changed

+42
-8
lines changed

ckanext/blocksmith/assets/css/vendor/grapesjs-component-code-editor.min.css

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

ckanext/blocksmith/assets/js/blocksmith-editor.js

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ckan.module("blocksmith-editor", function ($) {
1616
</svg>
1717
`,
1818
defaultContent: `
19-
<div class="page-wrapper" style="font-family: sans-serif; padding: 40px;">
19+
<div class="page-wrapper" style="font-family: sans-serif; background: #fff; padding: 40px;">
2020
<header style="text-align: center; padding: 20px 0;">
2121
<h1 style="margin: 0; font-size: 2.5em;">Welcome to Your Page</h1>
2222
<p style="color: #555;">Customize this page with the builder</p>
@@ -79,11 +79,14 @@ ckan.module("blocksmith-editor", function ($) {
7979
`
8080
},
8181
options: {
82-
pageId: null
82+
pageId: null,
83+
defaultContent: null,
84+
test: null
8385
},
8486
initialize: function () {
8587
$.proxyAll(this, /_/);
8688

89+
this.defaultContent = this.options.content || this.defaultContent;
8790
this.page = null;
8891
this.editor = null;
8992

@@ -115,7 +118,15 @@ ckan.module("blocksmith-editor", function ($) {
115118
pages: [{ component: this.defaultContent }]
116119
},
117120
container: this.el[0],
118-
plugins: ["grapesjs-preset-webpage", "gjs-blocks-basic", "grapesjs-navbar", "grapesjs-plugin-forms"],
121+
plugins: [
122+
"gjs-blocks-basic",
123+
"grapesjs-preset-webpage",
124+
"grapesjs-navbar",
125+
"grapesjs-plugin-forms",
126+
"grapesjs-blocks-flexbox",
127+
"grapesjs-component-code-editor",
128+
"grapesjs-parser-postcss"
129+
],
119130
pluginsOpts: {
120131
"grapesjs-preset-webpage": {
121132
textCleanCanvas: "Are you sure you want to clear the canvas?",
@@ -129,7 +140,10 @@ ckan.module("blocksmith-editor", function ($) {
129140
"column3-7",
130141
"text",
131142
"link",
132-
"image", "video", "map"]
143+
"image",
144+
"video",
145+
"map"
146+
]
133147
},
134148
"grapesjs-navbar": {
135149
classPrefix: "gjs-navbar"
@@ -145,8 +159,18 @@ ckan.module("blocksmith-editor", function ($) {
145159
"checkbox",
146160
"radio"
147161
]
162+
},
163+
"grapesjs-blocks-flexbox": {
164+
stylePrefix: "gjs-",
148165
}
149-
}
166+
},
167+
});
168+
169+
this.editor.Panels.addButton("views", {
170+
id: "open-code",
171+
className: 'fa fa-code',
172+
command: "open-code",
173+
attributes: { title: "Open Code" }
150174
});
151175

152176
this.editor.Panels.addButton("options", {

ckanext/blocksmith/assets/js/blocksmith-tabulator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ ckan.module("blocksmith-tabulator", function ($) {
104104
* @returns {String} The formatted action cell
105105
*/
106106
_formatActionCell: function (rowData) {
107-
const readUrl = this.sandbox.client.url('/blocksmith/read/' + rowData.id);
107+
const readUrl = this.sandbox.client.url(rowData.url);
108108
const editUrl = this.sandbox.client.url('/blocksmith/edit/' + rowData.id);
109109

110110
return `

ckanext/blocksmith/assets/js/vendor/grapes-blocks-basic.min.js

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

ckanext/blocksmith/assets/js/vendor/grapes-blocks-flexbox.min.js

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

0 commit comments

Comments
 (0)