inherit
167837
0
Apr 30, 2013 15:32:12 GMT -8
leif
939
June 2011
akiglass
|
Post by leif on Nov 4, 2017 7:46:38 GMT -8
I am trying to find a way to get JavaScript from a UBBC button I can add to auto insert into the WYIWYG box. I'm having an easy time on other forum hosts, but not ProBoards. What's the secret to this?
|
|
#e61919
Support Staff
224482
0
1
May 7, 2024 17:17:25 GMT -8
Scott
23,349
August 2015
socalso
|
Post by Scott on Nov 4, 2017 12:40:32 GMT -8
leif, can you expand a bit more on what you're trying to do please.
|
|
inherit
201984
0
Sept 11, 2023 1:23:07 GMT -8
P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓
Using My Talents Elsewhere
3,314
November 2013
pastuleo23
|
Post by P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓ on Nov 5, 2017 9:55:41 GMT -8
I am trying to find a way to get JavaScript from a UBBC button I can add to auto insert into the WYIWYG box. I'm having an easy time on other forum hosts, but not ProBoards. What's the secret to this? chrome.google.com/webstore/detail/visual-event/pbmmieigblcbldgdokdjpioljjninaim?hl=en-USIf you want to see the JavaScript proboards attaches to the buttons (onclick events) install that and click it on the page you want to view. Double clicking will remove a handler. You can see multiple events attached and can cycle through them if you need. If your only goal is to make your own button, there is a code Chris made that I modified that you can use. I want to note that if you do make your own code, you should test it in IE, Firefox, and chrome because the WYSIWYG editor is actually handled different for each browser
|
|
inherit
167837
0
Apr 30, 2013 15:32:12 GMT -8
leif
939
June 2011
akiglass
|
Post by leif on Nov 5, 2017 16:35:48 GMT -8
Scott --
I'm working on a code that will automatically insert something you upload into your post. IT works flawlessly on Quick Reply insert. But it doesn't in the WYSIWYG, I'm finding it difficult to let an outside script inject text into that.
Pastuleo - Thanks! I'll try! Hopefully this will unlock some of the secrets.
|
|
inherit
201984
0
Sept 11, 2023 1:23:07 GMT -8
P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓
Using My Talents Elsewhere
3,314
November 2013
pastuleo23
|
Post by P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓ on Nov 6, 2017 12:06:28 GMT -8
Scott -- I'm working on a code that will automatically insert something you upload into your post. IT works flawlessly on Quick Reply insert. But it doesn't in the WYSIWYG, I'm finding it difficult to let an outside script inject text into that. Pastuleo - Thanks! I'll try! Hopefully this will unlock some of the secrets. Pay attention to the [note] and [/note] for inserting text before and after. This includes a modifier if text was already highlighted. (by Chris)
this.addCode = function(){
var wy = $('.wysiwyg-textarea').data('wysiwyg');
if(wy.currentEditorName == "bbcode") {
var text = wy.editors.bbcode.getSelectedText();
text = "[note]"+(text || "")+"[/note]"
wy.editors.bbcode.replaceSelection(text);
}else if(wy.currentEditorName == "visual") {
var doc = wy.editors.visual.document
if (window.getSelection) {
var frag = wy.editors.visual.getRange().cloneContents();
frag.appendChild(doc.createTextNode('[/note]'));
frag.insertBefore(doc.createTextNode("[note]"), frag.firstChild);
wy.editors.visual.replaceSelection(frag);
} else if (document.selection) {
var text = wy.editors.visual.getRange().htmlText;
text = "[note]"+(text || "")+"[/note]"
wy.editors.visual.getRange().pasteHTML(text)
}
}
}
If you just want to insert something, this has brought me success in the pm wysiwyg $('.visual-editor iframe').contents().find( "body" ).html('message')
$('.subject_input input').attr('value','title');
$('.editor.bbcode-editor textarea').attr('value','message');
|
|