diff --git a/cypress/integration/workspace.js b/cypress/integration/workspace.js index 9701e54c5e..f18e48aadc 100644 --- a/cypress/integration/workspace.js +++ b/cypress/integration/workspace.js @@ -14,7 +14,7 @@ context('Workspace 2.0', () => { it('Create Private Page', () => { cy.get('.codex-editor__redactor .ce-block'); - cy.get('.custom-actions button[data-label="Create%20Page"]').click(); + cy.get('.custom-actions button[data-label="Create%20Workspace"]').click(); cy.fill_field('title', 'Test Private Page', 'Data'); cy.fill_field('icon', 'edit', 'Icon'); cy.get_open_dialog().find('.modal-header').click(); @@ -29,7 +29,7 @@ context('Workspace 2.0', () => { cy.wait(500); cy.get('.codex-editor__redactor .ce-block'); - cy.get('.standard-actions .btn-secondary[data-label=Customize]').click(); + cy.get('.standard-actions .btn-secondary[data-label=Edit]').click(); }); it('Add New Block', () => { @@ -77,7 +77,7 @@ context('Workspace 2.0', () => { it('Delete Private Page', () => { cy.get('.codex-editor__redactor .ce-block'); - cy.get('.standard-actions .btn-secondary[data-label=Customize]').click(); + cy.get('.standard-actions .btn-secondary[data-label=Edit]').click(); cy.get('.sidebar-item-container[item-name="Test Private Page"]').find('.sidebar-item-control .delete-page').click(); cy.wait(300); diff --git a/frappe/desk/desktop.py b/frappe/desk/desktop.py index 27b985e429..e9036b98b0 100644 --- a/frappe/desk/desktop.py +++ b/frappe/desk/desktop.py @@ -368,7 +368,7 @@ def get_desktop_page(page): on desk. Args: - page (string): page name + page (json): page data Returns: dict: dictionary of cards, charts and shortcuts to be displayed on website diff --git a/frappe/public/js/frappe/views/workspace/blocks/card.js b/frappe/public/js/frappe/views/workspace/blocks/card.js index 975b32eea7..15e27fed40 100644 --- a/frappe/public/js/frappe/views/workspace/blocks/card.js +++ b/frappe/public/js/frappe/views/workspace/blocks/card.js @@ -14,7 +14,7 @@ export default class Card extends Block { constructor({ data, api, config, readOnly, block }) { super({ data, api, config, readOnly, block }); this.sections = {}; - this.col = this.data.col ? this.data.col : "12"; + this.col = this.data.col ? this.data.col : "4"; this.allow_customization = !this.readOnly; this.options = { allow_sorting: this.allow_customization, diff --git a/frappe/public/js/frappe/views/workspace/blocks/paragraph.js b/frappe/public/js/frappe/views/workspace/blocks/paragraph.js index b594f3459a..26afa65d51 100644 --- a/frappe/public/js/frappe/views/workspace/blocks/paragraph.js +++ b/frappe/public/js/frappe/views/workspace/blocks/paragraph.js @@ -123,10 +123,10 @@ export default class Paragraph extends Block { return true; } - save(toolsContent) { + save() { this.wrapper = this._element; return { - text: toolsContent.innerText, + text: this.wrapper.innerHTML, col: this.get_col(), }; } @@ -155,6 +155,9 @@ export default class Paragraph extends Block { return { text: { br: true, + b: true, + i: true, + a: true } }; } diff --git a/frappe/public/js/frappe/views/workspace/blocks/shortcut.js b/frappe/public/js/frappe/views/workspace/blocks/shortcut.js index 0943de202d..f7482a06f3 100644 --- a/frappe/public/js/frappe/views/workspace/blocks/shortcut.js +++ b/frappe/public/js/frappe/views/workspace/blocks/shortcut.js @@ -13,7 +13,7 @@ export default class Shortcut extends Block { constructor({ data, api, config, readOnly, block }) { super({ data, api, config, readOnly, block }); - this.col = this.data.col ? this.data.col : "12"; + this.col = this.data.col ? this.data.col : "4"; this.allow_customization = !this.readOnly; this.options = { allow_sorting: this.allow_customization, diff --git a/frappe/public/js/frappe/views/workspace/workspace.js b/frappe/public/js/frappe/views/workspace/workspace.js index b46c220d9d..719645feea 100644 --- a/frappe/public/js/frappe/views/workspace/workspace.js +++ b/frappe/public/js/frappe/views/workspace/workspace.js @@ -32,8 +32,8 @@ frappe.views.Workspace = class Workspace { 'private': {} }; this.sidebar_categories = [ - 'Public', - frappe.user.first_name() || 'Private' + 'My Workspaces', + 'Public' ]; this.tools = { header: { @@ -357,7 +357,7 @@ frappe.views.Workspace = class Workspace { let current_page = pages.filter(p => p.title == page.name)[0]; if (!this.is_read_only) { - this.setup_customization_buttons(current_page.is_editable); + this.setup_customization_buttons(current_page); return; } @@ -365,20 +365,20 @@ frappe.views.Workspace = class Workspace { this.page.clear_secondary_action(); this.page.clear_inner_toolbar(); - current_page.is_editable && this.page.set_secondary_action(__("Customize"), () => { + current_page.is_editable && this.page.set_secondary_action(__("Edit"), () => { if (!this.editor || !this.editor.readOnly) return; this.is_read_only = false; this.editor.readOnly.toggle(); this.editor.isReady.then(() => { this.initialize_editorjs_undo(); - this.setup_customization_buttons(true); + this.setup_customization_buttons(current_page); this.show_sidebar_actions(); this.make_sidebar_sortable(); this.make_blocks_sortable(); }); }); - this.page.add_inner_button(__("Create Page"), () => { + this.page.add_inner_button(__("Create Workspace"), () => { this.initialize_new_page(); }); } @@ -389,13 +389,13 @@ frappe.views.Workspace = class Workspace { this.undo.readOnly = false; } - setup_customization_buttons(is_editable) { + setup_customization_buttons(page) { let me = this; this.page.clear_primary_action(); this.page.clear_secondary_action(); this.page.clear_inner_toolbar(); - is_editable && this.page.set_primary_action( + page.is_editable && this.page.set_primary_action( __("Save Customizations"), () => { this.page.clear_primary_action(); @@ -424,6 +424,10 @@ frappe.views.Workspace = class Workspace { } ); + page.name && this.page.add_inner_button(__("Settings"), () => { + frappe.set_route(`workspace/${page.name}`); + }); + Object.keys(this.blocks).forEach(key => { this.page.add_inner_button(` ${this.blocks[key].toolbox.icon} @@ -446,7 +450,7 @@ frappe.views.Workspace = class Workspace { $(`${frappe.utils.icon("lock", "sm")}`) .appendTo(sidebar_control); sidebar_control.parent().click(() => { - frappe.show_alert({ + !this.is_read_only && frappe.show_alert({ message: __("Only Workspace Manager can sort or edit this page"), indicator: 'info' }, 5); @@ -498,9 +502,9 @@ frappe.views.Workspace = class Workspace { prepare_sorted_sidebar(is_public) { if (is_public) { - this.sorted_public_items = this.sort_sidebar(this.sidebar.find('.standard-sidebar-section').first()); + this.sorted_public_items = this.sort_sidebar(this.sidebar.find('.standard-sidebar-section').last()); } else { - this.sorted_private_items = this.sort_sidebar(this.sidebar.find('.standard-sidebar-section').last()); + this.sorted_private_items = this.sort_sidebar(this.sidebar.find('.standard-sidebar-section').first()); } } @@ -578,7 +582,7 @@ frappe.views.Workspace = class Workspace { if (!this.validate_page(values)) return; d.hide(); this.initialize_editorjs_undo(); - this.setup_customization_buttons(true); + this.setup_customization_buttons({is_editable: true}); this.title = values.title; this.icon = values.icon; this.parent = values.parent; @@ -647,7 +651,7 @@ frappe.views.Workspace = class Workspace { ); $sidebar_item.find('.sidebar-item-control .drag-handle').css('margin-right', '8px'); - let $sidebar_section = is_public ? $sidebar[0] : $sidebar[1]; + let $sidebar_section = is_public ? $sidebar[1] : $sidebar[0]; if (!parent) { !is_public && $sidebar.last().removeClass('hidden'); diff --git a/frappe/public/scss/desk/desktop.scss b/frappe/public/scss/desk/desktop.scss index 0db526978f..49ed07bbce 100644 --- a/frappe/public/scss/desk/desktop.scss +++ b/frappe/public/scss/desk/desktop.scss @@ -946,7 +946,11 @@ body { &.new-widget { align-items: inherit; } - + + &.ce-paragraph { + display: block; + } + .paragraph-control { display: flex; flex-direction: row-reverse;