Jump to content

New post – Implementing and using TinyMCE 6 in ProcessWire


ryan
 Share

Recommended Posts

As I've had the exact same issue yesterday (and also have been adding those rules to every single project) RockFrontend v2.34.0 adds those rules in the defaults.less file wich you simply have to add to your styles array:

$rockfrontend->styles()
  ->add('/site/modules/RockFrontend/less/defaults.less') // add this line

  // uikit styles
  ->add('/site/templates/uikit-3.16.3/src/less/uikit.theme.less')
  ->add('/site/modules/RockFrontend/uikit/defaults.less')

  ...

  // minify on production
  ->minify(!$config->debug);

 

Link to comment
Share on other sites

  • 5 months later...

Hi,

i've coded a little plugin that wraps some selected content, several p's, h and so on inside div but i run into a funny behaviour of the editor

onAction: function () {
let cnt = editor.selection.getContent({format: 'html'});
editor.selection.setContent('<div class="box">' + cnt + '</div>', { format: 'html' });
}

It works fine but tiny adds an an empty p before and after the div, not really a problem as i always use the remove empty p option but just wondering why 🙂

have a nice day

Link to comment
Share on other sites

Without looking at it directly, I'm pretty sure the default setting/configuration for TinyMCE is to wrap all content in paragraph tags. However it knows enough to not wrap a DIV element in a paragraph, thus it falls back to doing what you notice it does. There should be a way to either disable the automatic paragraph, and/or switch it for a DIV, if that's what you (will always?) want. IIRC both TinyMCE and CKEditor (v4) both do that.

Link to comment
Share on other sites

Hi,

@BrendonKoz thanks a lot for your answer 🙂

you know, using templates as i describe in this thread

it works and insert divs  or tags of all sorts without wrapping them with empty p's before and after hence my wondering 🙂

actually i can do all i want with this template thing but imagine, you write a long post and suddenly realize somme p's would be nice highlited in a box with a background and some nice styles, hop, with this little plugin you can just select them, click and job done
i know, i know, just a lazy option 😄 as you could insert a template and then cut and paste the content you want into it but i like to make my customers' life as easy and obvious as possible, something the createDiv in CKeditor allowed and i tried to reproduce 🙂

not really important but i'm wondering and won't stop searching (probably studying other plugins code, templates for example...) until i find out the right way to do this 🙂 even if, like i said, with the remove empty p option, not really a problem + it's easy to delete those p's even before saving

have a nice day

Edited to say: funny enough, if i use insertContent instead of setContent it only adds one empty p after the div, curiouser and curiouser 😄

Edited again to say: i think i understand why the empty p after the inserted div as in tinymce if it's the last thing you insert  and want to add a p after it, hitting enter, it will insert a new div, a bit more confusing for people not used to notice it and convert it into a p, just don't know why it doesn't happen with the template plugin but well, mine is ready, i'll probably post it on github 🙂

Edited once more but for good this time 🙂
it's on github in case anyone may need it
https://github.com/virtualgadjo/pw-tinymce-div-plugin

  • Like 2
Link to comment
Share on other sites

  • 6 months later...

Bad news for all of us: 

https://github.com/tinymce/tinymce/discussions/9496

"....we have decided to release TinyMCE 7 under the GNU General Public License Version 2 or later, abbreviated as GPLv2+..."

To see why this is pretty bad news, read: https://github.com/BookStackApp/BookStack/issues/4908

BTW, I am a happy admin user of BookStack which is highly recommended!

Now BookStack and ProcessWire share the pain of TinyMCE moving away from MIT :(

  • Like 3
Link to comment
Share on other sites

26 minutes ago, szabesz said:

Bad news for all of us: 

https://github.com/tinymce/tinymce/discussions/9496

"....we have decided to release TinyMCE 7 under the GNU General Public License Version 2 or later, abbreviated as GPLv2+..."

To see why this is pretty bad news, read: https://github.com/BookStackApp/BookStack/issues/4908

BTW, I am a happy admin user of BookStack which is highly recommended!

Now BookStack and ProcessWire share the pain of TinyMCE moving away from MIT 😞

If I'm understanding this correctly, this would mean all of ProcessWire would have to be open-source, meaning the commercial modules, correct?  Related.

Link to comment
Share on other sites

That sucks, but I'm guessing they might make exceptions for some projects, so I'll have to ask them. Still, not nearly as much of an issue as what CKEditor did. But if it stays GPL and they don't make an exception for any projects, then most likely we couldn't include TinyMCE 7 with the core. In that case, we'd develop it was a non-core module, and folks would have to install it as a 3rd party module (in /site/modules/). ProcessWire's core is completely separate from what people develop or what they might add-on their site, so they don't have to share the same license. PW is built so that modules are independent of ProcessWire in the same way WP and PW are separate applications that can run on the same webserver, or a website is independent of the webserver that's delivering it, or a browser is independent of the HTML it renders or JS it executes.  https://processwire.com/about/license/3rd-party-files/

  • Like 9
Link to comment
Share on other sites

  • 2 months later...
On 3/25/2024 at 5:01 PM, ryan said:

That sucks, but I'm guessing they might make exceptions for some projects, so I'll have to ask them.

Any news on this? Just curious 🙂 

  • Like 1
Link to comment
Share on other sites

10 hours ago, BrendonKoz said:

From the comments of the linked article, there was a link to this information which covers end-of-life for v6, as well as the ability for open source projects to apply for a separate license for v7:

https://github.com/tinymce/tinymce/discussions/9609

@ryan That sounds promising, quote:

TinyMCE for Open Source
We recognize that the GPL may not align with the needs of certain free and open source (FOSS) projects. In response, we are introducing the TinyMCE for Open Source program that will provide a custom license to qualified open-source projects.
This custom license will permit the use of TinyMCE 7+ in open-source projects with a license that is incompatible with GPLv2+. To apply for the Tiny for Open Source Program, please fill out and submit an application "there".

Edited by szabesz
typo fix
  • Like 5
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...