-
Notifications
You must be signed in to change notification settings - Fork 220
DOC-3243: New view_show option to display a specified view on initialization #4021
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kemister85
wants to merge
1
commit into
feature/8.4.0/DOC-3243
Choose a base branch
from
feature/8.4.0/DOC-3243_TINY-11967
base: feature/8.4.0/DOC-3243
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -125,6 +125,13 @@ For information on using Enhanced Skins & Icon Packs, see: xref:enhanced-skins-a | |||
|
|
||||
| // CCFR here. | ||||
|
|
||||
| === New `view_show` option to display a specified view on initialization. | ||||
| // #TINY-11967 | ||||
|
|
||||
| Previously, integrators could not configure the editor to open with a specific view (such as Suggested Edits or Revision History) displayed on initialization. This was needed when users would only need to resolve suggested changes or review content, or when the current user had permission only to review changes. | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Since this is a new feature, we don't need to describe the previous behaviour. |
||||
|
|
||||
| In {productname} {release-version}, the new xref:custom-view.adoc#view_show[`+view_show+`] option allows specifying which view to display when the editor is initialized. The option behaves similarly to `+sidebar_show+` but takes precedence for views; both sidebars and views can be configured to show on init. | ||||
|
|
||||
|
|
||||
| [[changes]] | ||||
| == Changes | ||||
|
|
||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,61 @@ | ||||||
| [[view_show]] | ||||||
| == `+view_show+` | ||||||
|
|
||||||
| This option allows the specified view to be displayed on editor initialization. It behaves similarly to xref:customsidebar.adoc#sidebar_show[`+sidebar_show+`] but applies to views and takes precedence when both are configured. Views and sidebars can both be set to show on init. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| The value must match the name of a registered view. Premium plugins that register views include: | ||||||
|
|
||||||
| * xref:suggestededits.adoc[Suggested Edits] (`+suggestededits+`) | ||||||
| * xref:revisionhistory.adoc[Revision History] (`+revision+`) | ||||||
| * xref:advcode.adoc[Enhanced Code Editor] (`+code+`) | ||||||
|
|
||||||
| Custom views registered via xref:custom-view.adoc[`+addView+`] can also be specified. | ||||||
|
|
||||||
| include::partial$misc/admon-iframe-only.adoc[] | ||||||
|
|
||||||
| *Type:* `+String+` | ||||||
|
|
||||||
| === Example: using `+view_show+` with a premium plugin | ||||||
|
|
||||||
| [source,js] | ||||||
| ---- | ||||||
| tinymce.init({ | ||||||
| selector: 'textarea', // change this value according to your HTML | ||||||
| plugins: 'suggestededits', | ||||||
| toolbar: 'suggestededits', | ||||||
| view_show: 'suggestededits', | ||||||
| // ... other Suggested Edits options (suggestededits_model, user_id, fetch_users) | ||||||
| }); | ||||||
| ---- | ||||||
|
|
||||||
| === Example: using `+view_show+` with a custom view | ||||||
|
|
||||||
| [source,js] | ||||||
| ---- | ||||||
| tinymce.init({ | ||||||
| selector: 'textarea', // change this value according to your HTML | ||||||
| menubar: false, | ||||||
| toolbar: 'view', | ||||||
| view_show: 'view', | ||||||
| setup: (editor) => { | ||||||
| const toggleView = () => editor.execCommand('ToggleView', false, 'view'); | ||||||
| editor.ui.registry.addView('view', { | ||||||
| onShow: (api) => { | ||||||
| api.getContainer().innerHTML = '<p>You opened the view!</p>'; | ||||||
| }, | ||||||
| onHide: (api) => { | ||||||
| api.getContainer().innerHTML = ''; | ||||||
| }, | ||||||
| buttons: [{ | ||||||
| type: 'button', | ||||||
| text: 'Close', | ||||||
| onAction: toggleView | ||||||
| }] | ||||||
| }); | ||||||
| editor.ui.registry.addButton('view', { | ||||||
| text: 'Open view', | ||||||
| onAction: toggleView | ||||||
| }); | ||||||
| } | ||||||
| }); | ||||||
| ---- | ||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| == Show view on editor load | ||
|
|
||
| The xref:custom-view.adoc#view_show[`+view_show+`] option can be used to show the {pluginname} view when the editor is loaded. | ||
|
|
||
| .For example: | ||
| [source,js] | ||
| ---- | ||
| tinymce.init({ | ||
| selector: 'textarea', // change this value according to your HTML | ||
| plugins: 'advcode', | ||
| toolbar: 'code', | ||
| view_show: 'code', | ||
| }); | ||
| ---- |
15 changes: 15 additions & 0 deletions
15
modules/ROOT/partials/plugins/revisionhistory-open-view.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| == Show view on editor load | ||
|
|
||
| The xref:custom-view.adoc#view_show[`+view_show+`] option can be used to show the {pluginname} view when the editor is loaded. | ||
|
|
||
| .For example: | ||
| [source,js] | ||
| ---- | ||
| tinymce.init({ | ||
| selector: 'textarea', // change this value according to your HTML | ||
| plugins: 'revisionhistory', | ||
| toolbar: 'revisionhistory', | ||
| view_show: 'revision', | ||
| revisionhistory_fetch: () => Promise.resolve([]), // Replace with API request to get saved revisions | ||
| }); | ||
| ---- |
15 changes: 15 additions & 0 deletions
15
modules/ROOT/partials/plugins/suggestededits-open-view.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| == Show view on editor load | ||
|
|
||
| The xref:custom-view.adoc#view_show[`+view_show+`] option can be used to show the {pluginname} view when the editor is loaded. | ||
|
|
||
| .For example: | ||
| [source,js] | ||
| ---- | ||
| tinymce.init({ | ||
| selector: 'textarea', // change this value according to your HTML | ||
| plugins: 'suggestededits', | ||
| toolbar: 'suggestededits', | ||
| view_show: 'suggestededits', | ||
| // ... other Suggested Edits options (e.g. suggestededits_model, user_id, fetch_users) | ||
| }); | ||
| ---- |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.