Skip to main content
Topic: Add an sceditor ctrl-enter (split quote) toolbar button (Read 6804 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Add an sceditor ctrl-enter (split quote) toolbar button

So one handy thing on sceditor is that hitting ctrl-enter automatically breaks a quote.  Very handy.  But annoyingly my phone has no easy way to send ctrl-enter.  And it's on my phone where I'd REALLY like to have an auto quote splitting feature as it's a lot more annoying to type all the open and close quote bbc codes on the phone than on a desktop keyboard.

I've not looked at how the ctrl-enter operates in sceditor, but I was wondering how difficult it would be to have a split quote button on the sceditor toolbar that did the equivalent of ctrl-enter at the current cursor location.

Re: Add an sceditor ctrl-enter (split quote) toolbar button

Reply #1

Good point.

The split is performed by the splittag.plugin.js put together by @Spuds.
Adding a button requires some moving around of stuff, but it's not too difficult.

If you want to give it a try, replace the splittag.plugin.js file with the attached.
Then, in jquery.sceditor.css (or even in custom.css) you add something like this:
Code: [Select]
.sceditor-button-splittag div {
background: url('../images/bbc/splittag.png');
}
pointing to the image you want to use (or using the base64 encoded image as background).

And finally, in Editor.subs.php, you can add the button, for example replacing:
Code: [Select]
array('spoiler', 'footnote'),
with:
Code: [Select]
array('spoiler', 'footnote', 'splittag'),
Bugs creator.
Features destroyer.
Template killer.

Re: Add an sceditor ctrl-enter (split quote) toolbar button

Reply #2

Yup should be easy ... but do note it does not work in wizzy mode so in that mode the button should be disabled.  I has some code that sorta worked in wizzy but it gets overly complicated so I binned it.

Re: Add an sceditor ctrl-enter (split quote) toolbar button

Reply #3

Thanks.  I'll give it a try next time I have a moment to tinker.  (You guys are too quick.)  Fortunately all of my active forum members have told me they have no use for wizzy mode.

Will the new plugin attached still work with ctrl-enter as well as the button?  Or just the button?

Re: Add an sceditor ctrl-enter (split quote) toolbar button

Reply #4

A quick test answered my question.  ctrl-enter still works.  To get it to disable itself in wizzy mode this code shouldn't be present.
Code: [Select]
		exec: function() {
oSplitTags = new elk_SplitTags();

oSplitTags.split();
},
Just the txtExec part.  It seems that's how sceditor is told that a function doesn't work in a certain mode.  So leaving that out automatically disables the button when wizzy mode is entered.

Re: Add an sceditor ctrl-enter (split quote) toolbar button

Reply #5

Ok, I'm going to go ahead and test this on my live forum.  I've attached a modified plugin where the button is inactive in wizzy mode and has a more meaningful tooltip.  Also a png file that anyone is welcome to grab.  I'm going to place the button in a group by itself on the leftmost part of line1.  i.e. just to the left of bold.  That way it's easy to hit on mobile without hitting something obnoxious that is a pain to undo on mobile.

Re: Add an sceditor ctrl-enter (split quote) toolbar button

Reply #6

Well first snag for me.  Works great on a PC, but on my android phone running kitkat 4.4 with stock google keyboard it only works if I first dismiss the keyboard by using the phones back button.  So I have put the cursor where I want.  Then dismiss the keyboard.  Then push the split quote button.  And things do what they should.   If I don't dismiss the keyboard first nothing happens when I push the split quote button.

I've asked others on my forum to try on their touch devices.  I'll let you know if I hear anything useful back.

Re: Add an sceditor ctrl-enter (split quote) toolbar button

Reply #7

Apparently no dismissal of keyboard required on an iphone.  Works as expected.

Re: Add an sceditor ctrl-enter (split quote) toolbar button

Reply #8

There seems to be another sceditor/android issue in general.  The plugin event doesn't even fire with the keyboard open.  But if you insert an emoticon or type first then the split quotes works as expected.  Sigh.

Re: Add an sceditor ctrl-enter (split quote) toolbar button

Reply #9

Interesting oddity...
Bugs creator.
Features destroyer.
Template killer.

Re: Add an sceditor ctrl-enter (split quote) toolbar button

Reply #10

Did you try it under different android browsers ?

Re: Add an sceditor ctrl-enter (split quote) toolbar button

Reply #11

Not yet.  Just chrome stable.

Re: Add an sceditor ctrl-enter (split quote) toolbar button

Reply #12

Just curious if it was a droid or browser or event issue, or a yummy combo of all :P

Re: Add an sceditor ctrl-enter (split quote) toolbar button

Reply #13

I'll try to install dolphin or firefox and see what happens with them.

Re: Add an sceditor ctrl-enter (split quote) toolbar button

Reply #14

It works fine in dolphin and firefox on android.  So seems to be a chrome for android thing.