Merge pull request #37467 from sokumon/workspace-editor

This commit is contained in:
Suraj Shetty 2026-02-25 17:28:33 +05:30 committed by GitHub
commit 72cd685e33
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -493,6 +493,7 @@ frappe.views.Workspace = class Workspace {
let blocks = [
{
type: "header",
data: { text: values.title },
},
];
@ -666,7 +667,6 @@ frappe.views.Workspace = class Workspace {
spacer: this.blocks["spacer"],
HeaderSize: frappe.workspace_block.tunes["header_size"],
};
this.editor = new EditorJS({
data: {
blocks: blocks || [],
@ -676,6 +676,26 @@ frappe.views.Workspace = class Workspace {
readOnly: true,
logLevel: "ERROR",
});
if (blocks.length == 0) {
let message = __("Welcome to the {0} workspace", [this.page.title]);
let default_block = [
{
type: "header",
data: { text: message },
},
];
if (this.has_access) {
default_block.push({
type: "paragraph",
data: {
text: __("Click on {0} to edit", [frappe.utils.icon("ellipsis")]),
},
});
}
this.editor.isReady.then(() => {
this.editor.render({ blocks: default_block });
});
}
}
save_page(page) {