[PR #3387] [MERGED] Page editor switching #6187

Closed
opened 2026-02-05 10:26:28 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/BookStackApp/BookStack/pull/3387
Author: @ssddanbrown
Created: 4/17/2022
Status: Merged
Merged: 4/24/2022
Merged by: @ssddanbrown

Base: developmentHead: editor_switching


📝 Commits (10+)

  • 7dc80a9 Updated editor setting to reflect "Default editor"
  • e8e38f1 Added an 'editor-change' role permission
  • 0cc215f Added editor type change button
  • 956eb13 Aligned page edit controller method data usage
  • 492ffff Added core editor switching functionality
  • 2149926 Standardised dropdown list item styles, Extracted page editor toolbar
  • eff539f Added new confirm-dialog component, both view and logic
  • 4780674 Linked up confirmation prompt to editor switching
  • 1b46aa8 Aded tests for core editor switching functionality
  • bec61a5 Added listing of editor type to revisions

📊 Changes

42 files changed (+743 additions, -209 deletions)

View changed files

📝 app/Entities/Models/Page.php (+1 -0)
📝 app/Entities/Models/PageRevision.php (+3 -1)
📝 app/Entities/Repos/PageRepo.php (+28 -4)
📝 app/Entities/Tools/Markdown/HtmlToMarkdown.php (+1 -1)
app/Entities/Tools/Markdown/MarkdownToHtml.php (+37 -0)
📝 app/Entities/Tools/PageContent.php (+3 -28)
📝 app/Entities/Tools/PageEditActivity.php (+1 -1)
app/Entities/Tools/PageEditorData.php (+116 -0)
📝 app/Http/Controllers/PageController.php (+11 -41)
database/migrations/2022_04_17_101741_add_editor_change_field_and_permission.php (+62 -0)
resources/icons/swap-horizontal.svg (+1 -0)
📝 resources/js/components/auto-suggest.js (+1 -1)
📝 resources/js/components/code-editor.js (+1 -1)
resources/js/components/confirm-dialog.js (+52 -0)
📝 resources/js/components/index.js (+2 -2)
📝 resources/js/components/page-editor.js (+22 -0)
📝 resources/js/components/popup.js (+2 -2)
📝 resources/lang/en/entities.php (+11 -0)
📝 resources/lang/en/settings.php (+3 -2)
📝 resources/sass/_components.scss (+5 -0)

...and 22 more files

📄 Description

In progress branch of enabling change of editor at a page level.

Related to #119, #369, #458, #842

Progress

  • Update existing editor setting to reflect default.
  • Add new role permission for changing editor.
  • Add switch editor action within editor.
    • Save draft then reload with new editor content.
    • Markdown to HTML Conversion.
    • HTML to markdown conversion (Clean)
    • HTML to markdown conversion (Stable)
    • Prompt for HTML to markdown conversion.
  • Show editor/content type indicator in revisions.
  • Update API to suit.
  • Testing
    • Permission enforcement for pre-save draft
    • Permission enforcement for post-save draft
    • Permission enforcement for non-draft save

Questionables

  • How does API interaction work here? Depend on content type or separate property to define active editor option?
    • We currently allow pushing whatever type of content in, but editor remains depending on global setting. Seperate property, controlled via permission, would align most in forward compatible way.
    • Going to depend on content type, in combination with having the permissions, Can always allow additional control if needed in future.

Potentially Breaking Changes

  • REST API page-create/update actions may now cause the editor, for that page, to change for future in-platform editors depending upon content type.

Preview

https://user-images.githubusercontent.com/8343178/164977916-9c8beee1-8578-43cd-b877-accb55e97fb6.mp4


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/BookStackApp/BookStack/pull/3387 **Author:** [@ssddanbrown](https://github.com/ssddanbrown) **Created:** 4/17/2022 **Status:** ✅ Merged **Merged:** 4/24/2022 **Merged by:** [@ssddanbrown](https://github.com/ssddanbrown) **Base:** `development` ← **Head:** `editor_switching` --- ### 📝 Commits (10+) - [`7dc80a9`](https://github.com/BookStackApp/BookStack/commit/7dc80a9e14855a56a1d5c18ccb1a92a82b1e6250) Updated editor setting to reflect "Default editor" - [`e8e38f1`](https://github.com/BookStackApp/BookStack/commit/e8e38f1f7bcc7190a2fc8298f114cd0443ee55f5) Added an 'editor-change' role permission - [`0cc215f`](https://github.com/BookStackApp/BookStack/commit/0cc215f8c3ccf75af60d404b385f825d41ad684a) Added editor type change button - [`956eb13`](https://github.com/BookStackApp/BookStack/commit/956eb1308fe63b0d1b3cc3765a2f2b77d2dc8396) Aligned page edit controller method data usage - [`492ffff`](https://github.com/BookStackApp/BookStack/commit/492ffff0a488d3bd9b3759686a037edf6190844b) Added core editor switching functionality - [`2149926`](https://github.com/BookStackApp/BookStack/commit/214992650db16bceca439a60d45fb78035d38af1) Standardised dropdown list item styles, Extracted page editor toolbar - [`eff539f`](https://github.com/BookStackApp/BookStack/commit/eff539f89beb23c9ba7c86776d85a3e5e8412276) Added new confirm-dialog component, both view and logic - [`4780674`](https://github.com/BookStackApp/BookStack/commit/478067483f49c8b2cb6ed2d52ad832fd79dd2701) Linked up confirmation prompt to editor switching - [`1b46aa8`](https://github.com/BookStackApp/BookStack/commit/1b46aa87565547ff7af21dfec1c2d7d89ff4873d) Aded tests for core editor switching functionality - [`bec61a5`](https://github.com/BookStackApp/BookStack/commit/bec61a56c0c73ea980ffa18a737560d22b5aa836) Added listing of editor type to revisions ### 📊 Changes **42 files changed** (+743 additions, -209 deletions) <details> <summary>View changed files</summary> 📝 `app/Entities/Models/Page.php` (+1 -0) 📝 `app/Entities/Models/PageRevision.php` (+3 -1) 📝 `app/Entities/Repos/PageRepo.php` (+28 -4) 📝 `app/Entities/Tools/Markdown/HtmlToMarkdown.php` (+1 -1) ➕ `app/Entities/Tools/Markdown/MarkdownToHtml.php` (+37 -0) 📝 `app/Entities/Tools/PageContent.php` (+3 -28) 📝 `app/Entities/Tools/PageEditActivity.php` (+1 -1) ➕ `app/Entities/Tools/PageEditorData.php` (+116 -0) 📝 `app/Http/Controllers/PageController.php` (+11 -41) ➕ `database/migrations/2022_04_17_101741_add_editor_change_field_and_permission.php` (+62 -0) ➕ `resources/icons/swap-horizontal.svg` (+1 -0) 📝 `resources/js/components/auto-suggest.js` (+1 -1) 📝 `resources/js/components/code-editor.js` (+1 -1) ➕ `resources/js/components/confirm-dialog.js` (+52 -0) 📝 `resources/js/components/index.js` (+2 -2) 📝 `resources/js/components/page-editor.js` (+22 -0) 📝 `resources/js/components/popup.js` (+2 -2) 📝 `resources/lang/en/entities.php` (+11 -0) 📝 `resources/lang/en/settings.php` (+3 -2) 📝 `resources/sass/_components.scss` (+5 -0) _...and 22 more files_ </details> ### 📄 Description In progress branch of enabling change of editor at a page level. Related to #119, #369, #458, #842 ### Progress - [x] Update existing editor setting to reflect default. - [x] Add new role permission for changing editor. - [x] Add switch editor action within editor. - [x] Save draft then reload with new editor content. - [x] Markdown to HTML Conversion. - [x] HTML to markdown conversion (Clean) - [x] HTML to markdown conversion (Stable) - [x] Prompt for HTML to markdown conversion. - [x] Show editor/content type indicator in revisions. - [x] Update API to suit. - [x] Testing - [x] Permission enforcement for pre-save draft - [x] Permission enforcement for post-save draft - [x] Permission enforcement for non-draft save ### Questionables - How does API interaction work here? Depend on content type or separate property to define active editor option? - We currently allow pushing whatever type of content in, but editor remains depending on global setting. Seperate property, controlled via permission, would align most in forward compatible way. - **Going to depend on content type, in combination with having the permissions, Can always allow additional control if needed in future.** ### Potentially Breaking Changes - REST API page-create/update actions may now cause the editor, for that page, to change for future in-platform editors depending upon content type. ### Preview https://user-images.githubusercontent.com/8343178/164977916-9c8beee1-8578-43cd-b877-accb55e97fb6.mp4 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-05 10:26:28 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#6187