First of all, thanks ufku for this great module.

I wanted to create a tutorial page which will include textareas including html code and then use BUEditor's preview functionality to enable users to see the result of the HTML. To do that I created a new editor instance which only includes the preview button and then set its visibility settings for that specific node (let's say: node/1234). Since this path doesn't match the visibility settings of the default editor, I was hoping when I view the node I was able to see preview button atttached to the textareas but that wasn't the case. I gave textareas distinct name and id attributes even tried to wrap them in form elements but the result was same. I tried disabled, readonly attributes on and off but that didn't help neither.

Am I missing something or is this not possible to do?

Thanks for your time.

Comments

ufku’s picture

hi pempeci,
that's kinda interesting use case. I think you'll need to create a php page to settle bue manually, because it processes only the textareas that are created by drupals form system. Hard-coded textareas are not recognized .
Here is a solution that settles bueditor by faking textarea processing.

<?php bueditor_textarea(array('#id' => 'none')); /*run only once*/?>

<textarea class="editor-textarea"></textarea>
<textarea class="foo bar editor-textarea"></textarea>

Two requirements for this to work:
1- Input format must be php for the page
2- All hard-coded textareas must have the class name "editor-textarea"

You should notice that user roles will see their own assigned editor on the page.(if the page path is defined in the visibility settings.)

If you want everyone to see the same interface regardless of bue settings, you should force a specific editor to settle by replacing the above php code with this:
<?php bueditor_settle(bueditor_editors(YOUR-EDITOR-ID, FALSE)); /*change the editor id*/?>

or see http://ufku.com/drupal/bueditor/non-drupal for manual bue integration in any page.

good luck.

pembeci’s picture

Sorry for responding late. Thanks for the hints. I'd prefer the second option but it still requires me to assign a specific editor to a user role to attach the BUEditor. So it almost works. I'll use the "editor-textarea" class in the second option as well, right?

ufku’s picture

Yes, "editor-textarea" class is required. Optionally, you can settle the editor dynamically on any textarea using editor.processTextarea(TEXTAREA_ELEMENT).

Using the below code I could make editor#1 visible for everyone(regardless of their editor assignment):

<?php bueditor_settle(bueditor_editors(1, FALSE)); ?>

<textarea class="editor-textarea"></textarea>

FYI, in BUE 6.x it is possible to use different editors for each textarea:

<?php
bueditor_settle(bueditor_editors(1));
bueditor_settle(bueditor_editors(2));

drupal_add_js('BUE.preset.push(["foo", "e1"]);', 'inline');
drupal_add_js('BUE.preset.push(["bar", "e2"]);', 'inline');
?>

<textarea id="foo"></textarea>
<textarea id="bar"></textarea>
pembeci’s picture

Status: Active » Closed (fixed)

Instead of an integer I was giving the editor's name in a string as EDITOR_ID. So now it is working as you described. Thanks for the support. Changing the status to closed.

ufku’s picture

Status: Closed (fixed) » Fixed

ur wellcome. marking this as fixed for those who may be interested.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.