Skip to content
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

Enable customization of TinyMCE init options #4727

Merged
merged 4 commits into from
Apr 5, 2020

Conversation

MrCrayon
Copy link
Collaborator

@MrCrayon MrCrayon commented Feb 1, 2020

tinymce_init_callback and tinymce_setup_callback can only be used effectively to set events or do something after tinyMCE has been initialized, to change init options tinymce currently needs to be initialized, destroyed and reinitialized with new settings.

This PR:

  • Exports default settings options
  • Moves initialization to rich_text_box blade file
  • Checks if custom options are set in BREAD details to merge
  • Enables different settings for each textarea
  • Adds documentation

Warning
If tinyMCE was used without calling rich_text_box partial it will need to be initialized:

tinymce.init(window.voyagerTinyMCE.getConfig());

Closes #4551

@howdu
Copy link
Contributor

howdu commented Feb 3, 2020

Works well thanks - needed to re-compile via npm due to error:
Cannot read property 'getConfig' of undefined.

I tested by importing extra tinymce plugin into my use of the voyager additional_js importing the extra tinymce plugin there which works well with your changes.

It would be great if tinymce/ace editors were not so tightly coupled into the main voyager app.js file and loaded separately when needed.

@fletch3555 fletch3555 changed the base branch from 1.3 to 1.x February 4, 2020 19:42
@emptynick emptynick self-assigned this Mar 10, 2020
@codecov
Copy link

codecov bot commented Mar 10, 2020

Codecov Report

❗ No coverage uploaded for pull request base (1.4@4962328). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##             1.4    #4727   +/-   ##
======================================
  Coverage       ?   60.34%           
  Complexity     ?     1373           
======================================
  Files          ?      194           
  Lines          ?     3992           
  Branches       ?        0           
======================================
  Hits           ?     2409           
  Misses         ?     1583           
  Partials       ?        0

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4962328...a6cfc55. Read the comment docs.

@MrCrayon MrCrayon force-pushed the feature-custom-tinymcs-init branch from 670b126 to ad2448c Compare March 24, 2020 03:01
@MrCrayon MrCrayon changed the base branch from 1.x to 1.4 March 24, 2020 03:01
Copy link
Collaborator

@emptynick emptynick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple things:

Lets move the documentation from customization/tinymce.md and merge them together with what you created.
You also need to add a link in summary.md to your new file.

Also it is not very clear to me where I have to put the tinymceOptions.

@MrCrayon
Copy link
Collaborator Author

MrCrayon commented Apr 5, 2020

tinymceOptions go in BREAD details, I should add that.
I'll check the other things too 👍

tinymce_init_callback and tinymce_setup_callback can only be used effectively to set events or do something after tinyMCE has been initialized, to change init options tinymce currently needs to be initialized, destroyed and reinitialized with new settings.

This PR:
Exports default settings options
Moves initialization to rich_text_box.blade file
Checks if custom options are set in BREAD details to merge
Enables different settings for each textarea

Closes thedevdojo#4551
Added not in upgrade guide
Added link in summary
Clarified where to set tinymceOptions
@MrCrayon MrCrayon force-pushed the feature-custom-tinymcs-init branch from 4439495 to e088513 Compare April 5, 2020 04:30
@MrCrayon
Copy link
Collaborator Author

MrCrayon commented Apr 5, 2020

@emptynick I added a note to upgrade documentation, let me know if that's clear.

Copy link
Collaborator

@emptynick emptynick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, that's better

@emptynick emptynick merged commit 20f6b68 into thedevdojo:1.4 Apr 5, 2020
@MrCrayon MrCrayon deleted the feature-custom-tinymcs-init branch May 12, 2020 04:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tinymce modify settings before initilized
3 participants