vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=242)
-   -   [HOW TO] Add WYSIWYG Editor to Your Modifications (https://vborg.vbsupport.ru/showthread.php?t=228693)

MaryTheG(r)eek 04-17-2010 03:24 PM

1 Attachment(s)
Hello all,

The code to include qr editor is:

1.- PHP File
Code:

$editorid = construct_edit_toolbar('', false, 'nonforum', false, true, false, 'qr');
.......
$templater->register('editorid', $editorid);
$templater->register('messagearea', $messagearea);

2.- Template
Code:

<div class="wysiwyg_block">
<div class="blockbody formcontrols">
<div class="blockrow">
{vb:raw messagearea}
</div>
</div>
</div>

Works fine in 3 of my mods as you can see in the attached photo. Sorry, but as this article is not mine, I can't comes throught a full tutorial.

Maria

Vaupell 04-17-2010 03:37 PM

Quote:

Originally Posted by MicroHellas (Post 2022699)
Hello all,

The code to include qr editor is:

1.- PHP File
Code:

$editorid = construct_edit_toolbar('', false, 'nonforum', false, true, false, 'qr');
.......
$templater->register('editorid', $editorid);
$templater->register('messagearea', $messagearea);

2.- Template
Code:

<div class="wysiwyg_block">
<div class="blockbody formcontrols">
<div class="blockrow">
{vb:raw messagearea}
</div>
</div>
</div>

Works fine in 3 of my mods as you can see in the attached photo. Sorry, but as this article is not mine, I can't comes throught a full tutorial.

Maria


thank you so much, this was excaktly what i needed

I can get this working just fine, but the full editor wont work for me
message returns blank..

But this is fine,, Tx Maria ;) :up:

MaryTheG(r)eek 04-17-2010 04:10 PM

Quote:

Originally Posted by Vaupell (Post 2022705)
but the full editor wont work for me
message returns blank..

Just use this:
Code:

$editorid = construct_edit_toolbar($profile['bodytext'],1,'',0,1,($vbulletin->userinfo['userid']));
Please note that the last part is to show an editor according to usergroup permissions (eg full WYSIWYG). The first part, is the field name. You can use '' to let it empty.

Maria

Jaxel 04-17-2010 04:27 PM

I dont know man... I copy and pasted your code EXACTLY and I'm still getting the same error.
Code:

Uncaught ReferenceError: vB_Text_Editor is not defined
The text editor "works", it will accept input and what not, but the buttons on it (such as bold/italics) don't.

MaryTheG(r)eek 04-17-2010 04:33 PM

Quote:

Originally Posted by Jaxel (Post 2022737)
I dont know man... I copy and pasted your code EXACTLY and I'm still getting the same error.
Code:

Uncaught ReferenceError: vB_Text_Editor is not defined
The text editor "works", it will accept input and what not, but the buttons on it (such as bold/italics) don't.

You can ignore that error, as it's vB bug, and appears only to IE8. As for the buttons, be sure to include in the <head> section:
Code:

  <script type="text/javascript" src="clientscript/vbulletin-editor.js?v={vb:raw vboptions.simpleversion}"></script>
  <link rel="stylesheet" type="text/css" href="{vb:var vbcsspath}editor.css" />
  <link rel="stylesheet" type="text/css" href="{vb:var vbcsspath}bbcode.css" />

--------------- Added [DATE]1271525701[/DATE] at [TIME]1271525701[/TIME] ---------------

Quote:

Originally Posted by Jaxel (Post 2022737)
I dont know man...

By the way... I'm WOMAN.

Maria

Jaxel 04-17-2010 04:42 PM

Heh, sorry, woman... Anyways, I got all that and it's not making a difference, text editor buttons dont work... the error pops up on the console in Chrome too... This is all my code related to this...

Code:

if ($perms['comment'])
{
        require_once(DIR . '/includes/functions_editor.php');
        $editorid = construct_edit_toolbar('',0,'nonforum',1,1,0,'qr_small');
}

Code:

$templater->register('editorid', $editorid);
$templater->register('messagearea', $messagearea);

Code:

<vb:if condition="$perms['comment']">
        <script type="text/javascript" src="clientscript/vbulletin-editor.js?v={vb:raw vboptions.simpleversion}"></script>
        <link rel="stylesheet" type="text/css" href="{vb:var vbcsspath}editor.css" />
        <link rel="stylesheet" type="text/css" href="{vb:var vbcsspath}bbcode.css" />

        <form action="media.php" name="vbform" method="post" onsubmit="return vB_Editor['{vb:raw editorid}'].prepare_submit(this.inputname.value, {vb:raw vboptions.postminchars})">

        <div name="commentform" id="commentform">
                <div class="mediarow floatcontainer" style="padding: 10px;">
                        {vb:raw messagearea}
                </div>
        </div>
        <div style="padding-right: 30px; text-align: right;">
                <input type="submit" class="button" name="commentsubmit" id="commentsubmit" value="Submit Comment" />
        </div>

        <input type="hidden" name="s" value="{vb:raw session.sessionhash}" />
        <input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
        <input type="hidden" name="do" value="comment" />
        <input type="hidden" name="mid" value="{vb:var media.mediaID}" />

        </form>
</vb:if>


Everything works fine if I switch to the FE, instead of the QR... but I don't want to use the FE in this specific spot.

MaryTheG(r)eek 04-17-2010 04:51 PM

Quote:

Originally Posted by Jaxel (Post 2022746)
<form action="media.php" name="vbform" method="post" onsubmit="return vB_Editor['{vb:raw editorid}'].prepare_submit(this.inputname.value, {vb:raw vboptions.postminchars})">

You forgot a very important part of form declaration:
Code:

enctype="multipart/form-data"
Also is good to add a class:
Code:

class="block vbform"

Jaxel 04-17-2010 04:58 PM

The multipart/form-data encoding type shouldn't be required, as I'm not supporting attachments in this form. However, i added both that and the class just to test it out, and neither made a difference (except that the class made the style look ugly, which is why I removed it in the first place).

Buttons still not working.

Vaupell 04-17-2010 05:55 PM

Quote:

Originally Posted by MicroHellas (Post 2022730)
Just use this:
Code:

$editorid = construct_edit_toolbar($profile['bodytext'],1,'',0,1,($vbulletin->userinfo['userid']));
Please note that the last part is to show an editor according to usergroup permissions (eg full WYSIWYG). The first part, is the field name. You can use '' to let it empty.

Maria


Nope still wont transfer "message / bodycontents"

Ive made a video exsample
http://www.screencast.com/t/M2U2ZGU1NGUt

wow screencast stinks,, youtube for the win..
http://www.youtube.com/watch?v=MS2UXqNOA-0

i changed the "Type="POST" to TEST so i get the entire line postet in my URL field
for debugging.. and as seen on the video, message= thats it..


--------------- EDIT / UPDATE

If i change the editor mode to view BBcode (Aa button topright in editor) the text submit fine,
and it submits as wysiwyg=0 then it works.. which is strange..
so it has to be something with the initial setup...


--------------- EDIT / UPDATE 2 - it works if im logged out,
if im logged in, it dosent submit the textarea named message..
got to be login info in the php..


--------------- FINAL EDIT
just using Quick reply box, its the only one working for me..
the full editor got some problems with user permissions..

bpr 05-02-2010 10:34 PM

@Vaupell

i got the same problem ! but i am not as far as your edits describe - i want to figure out, how it works in a proper way!does anybody know a solution ?


All times are GMT. The time now is 11:36 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01934 seconds
  • Memory Usage 1,762KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (14)bbcode_code_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete