Adding a plugin to SMF 2.1 SCEditor

Started by JavaJones, August 14, 2019, 02:10:52 PM

Previous topic - Next topic

JavaJones

Is it possible to add any of the SCEditor plugins to SMF 2.1's version of the editor? I want to install this plugin:
https://www.sceditor.com/documentation/plugins/plaintext/ [nofollow]


I am attempting to follow the instructions but can't find that exact instantiation text anywhere in SMF's code. The closest I find is:

   sceditor.create = function (textarea, options) {
      // Call the original create function
      createFn(textarea, options);


Which is inside jquery.sceditor.smf.js

I'm unclear how to modify this similar but not identical code to call the plugin, or if the version of SCEditor in SMF even includes this plugin functionality.


- Oshyan



SychO

Go to Sources/Subs-Editor.php

look for

$sce_options = array(
'style' => $settings[file_exists($settings['theme_dir'] . '/css/jquery.sceditor.default.css') ? 'theme_url' : 'default_theme_url'] . '/css/jquery.sceditor.default.css',
'emoticonsCompat' => true,
'colors' => 'black,maroon,brown,green,navy,grey,red,orange,teal,blue,white,hotpink,yellow,limegreen,purple',
'format' => 'bbcode',
'plugins' => '',
'bbcodeTrim' => true,
);


add your plugin name there
Checkout My Themes:
-

Potato  •  Ackerman  •  SunRise  •  NightBreeze

JavaJones

Man, the support on this forum is awesome, thanks for the quick reply!

Unfortunately it does not seem to have any effect, or at least not the effect I expected. Pasting text still pastes it with formatting. Do you know if this plugin is included in the SMF 2.1 version of SCEditor, or a way I might find out?

- Oshyan

SychO

Yea you also have to upload plaintext.js to Themes/default/scripts and then load it using

loadJavaScriptFile('plaintext.js');

you can past that before the code above, it should work.

This can be made into a mod pretty easily, I think I'll make it.
Checkout My Themes:
-

Potato  •  Ackerman  •  SunRise  •  NightBreeze

SychO

Checkout My Themes:
-

Potato  •  Ackerman  •  SunRise  •  NightBreeze

JavaJones

Thanks so much! I had made the code changes manually but just undid them because maintaining it as a mod should be easier. I really appreciate your quick work here.

I'd encourage you to publicize this more widely, too. Because default paste behavior is frankly terrible, hah. If I am writing a post in WYSIWYG and switch to the plain text view, I see just my text. If I switch back to WYSIWYG, copy text from my post, then paste the text further down in the editor, and switch back to plain text, suddenly my pasted text has a bunch of formatting! And if I then post it with no further modification, my original text and copied text end up with different formatting (slight visual difference), even though one was copied from the other. Seems quite "off" to me.

Anyway, instead of complain about that (which I realize I've just done, hah), I thought I'd just try to fix it with the plain text plugin.

Thanks again!

- Oshyan

SychO

You're welcome :)

Quote from: JavaJones on August 14, 2019, 06:09:08 PM
I'd encourage you to publicize this more widely, too.

Yes this shall go into the mod site.
Checkout My Themes:
-

Potato  •  Ackerman  •  SunRise  •  NightBreeze

JavaJones

Hmm, ok so I got this error when trying to upload that as a mod via Package Manager:

An error has occurred
You did not select a package to upload.

But uploading it manually to the Packages directory worked. Just thought I'd mention it in case there's any adjustment you need to make. Could be something on my end.

- Oshyan

SychO

Your Packages folder might not be writable, its CHMOD needs to be set at 755 I believe
Checkout My Themes:
-

Potato  •  Ackerman  •  SunRise  •  NightBreeze

Advertisement: