Like SystemiConnectFri 15 Oct 2021, 04:50
Auto Save MessagesLGforumFri 26 Feb 2021, 13:31
New tutorial questionTheCrowMon 15 Feb 2021, 08:12
Support iOS Emojis (and other platforms)LGforumSun 14 Feb 2021, 01:25
LGforum (2806)
New Editor Fixing and Removing WYSIWYG Vote_lcapNew Editor Fixing and Removing WYSIWYG Voting_barNew Editor Fixing and Removing WYSIWYG Vote_rcap 
Mr.Easybb (1587)
New Editor Fixing and Removing WYSIWYG Vote_lcapNew Editor Fixing and Removing WYSIWYG Voting_barNew Editor Fixing and Removing WYSIWYG Vote_rcap 
Bloodbath (745)
New Editor Fixing and Removing WYSIWYG Vote_lcapNew Editor Fixing and Removing WYSIWYG Voting_barNew Editor Fixing and Removing WYSIWYG Vote_rcap 
Rukiafan (533)
New Editor Fixing and Removing WYSIWYG Vote_lcapNew Editor Fixing and Removing WYSIWYG Voting_barNew Editor Fixing and Removing WYSIWYG Vote_rcap 
Dom (513)
New Editor Fixing and Removing WYSIWYG Vote_lcapNew Editor Fixing and Removing WYSIWYG Voting_barNew Editor Fixing and Removing WYSIWYG Vote_rcap 
puppycheese (446)
New Editor Fixing and Removing WYSIWYG Vote_lcapNew Editor Fixing and Removing WYSIWYG Voting_barNew Editor Fixing and Removing WYSIWYG Vote_rcap 
pedro (330)
New Editor Fixing and Removing WYSIWYG Vote_lcapNew Editor Fixing and Removing WYSIWYG Voting_barNew Editor Fixing and Removing WYSIWYG Vote_rcap 
Neymar (301)
New Editor Fixing and Removing WYSIWYG Vote_lcapNew Editor Fixing and Removing WYSIWYG Voting_barNew Editor Fixing and Removing WYSIWYG Vote_rcap 
Hitsu (281)
New Editor Fixing and Removing WYSIWYG Vote_lcapNew Editor Fixing and Removing WYSIWYG Voting_barNew Editor Fixing and Removing WYSIWYG Vote_rcap 
Flora (275)
New Editor Fixing and Removing WYSIWYG Vote_lcapNew Editor Fixing and Removing WYSIWYG Voting_barNew Editor Fixing and Removing WYSIWYG Vote_rcap 


New Editor Fixing and Removing WYSIWYG

LGforumLGforum
Status : Working to restore AWC!

Posts : 2806
Join date : 2011-10-05
Age : 30
Location : UK
Thu 13 Jun 2013, 12:52
So as we all know the new editor is here and a lot of scripts relating to the old editor no longer work with it.

Well this small fix should allow most (not necessarily all) of your old scripts to continue working as they should. I know this will fix most of Avacwebs codes relating to the old editor.

Simply put this in a Javascript page and tick "In all Pages":
Code:
[panda=js]$(function() {
   var ta = document.getElementById('text_editor_textarea');
   if(ta && document.post) {
      var fix_it = function() {
         var sc = $(ta).data('sceditor');
         sc ? sc.bind('keypress', sc.updateOriginal).blur(sc.updateOriginal) : setTimeout(fix_it, 200);   
      };
      fix_it();
   }
});

This code should fix things, by keeping the old textarea up to date, and so allowing scripts that check the old textarea to continue working.

If you also want to remove the WYSIWYG mode (since it can cause a lot of stress when using the editor) then make these adjustments to the code above.
After this line: [ic]sc ? sc.bind('keypress', sc.updateOriginal) : setTimeout(fix_it, 200);[/ic] add this: [ic]$('.sceditor-button-source', ta.nextSibling).remove();[/ic]
And right at the start before everything else add this: [ic]my_setcookie('WYSIWYG_STATE', 0, true);[/ic]

Then you've fixed the editor and got rid of the WYSIWYG mode.

Hope that helps fix some of your issues
NeymarNeymar
Status : No status yet...

Posts : 301
Join date : 2012-03-11
Location : Glasgow, Scotland
Thu 13 Jun 2013, 18:50
It works a treat LG. New Editor Fixing and Removing WYSIWYG 1499845164

I had to clear the cache on the browser of my iPod though guys, it started letting me post again after I did that and added this script. It didn't before I cleared the cache. Whether that was a fluke or not, I don't know. Maybe LG can clear that up. Do we have to clear the browser cache sometimes for this to start working?


One other thing, I removed the WYSIWYG button using the bit of jQuery provided, but then I noticed by doing that I had trapped myself in the WYSIWYG mode as I had accidentally turned it on yesterday and then didn't have the option to turn it off. I really hope that not too many of the members on my forum have turned that mode on yesterday and are now trapped as well. I don't want too many people trying it either though if it's problematic. You can't really win with this new editor.



Edit: is there a way of globally switching the editor mode to totally remove WYSIWYG, as looking around I can see some posts with strange colours/font styles that have obviously been caused by this WYSIWYG mode?



Second edit: I just found something really really weird with this new editor. I think if a full stop is the very last character in a post, the full stop does not show.

Examples:

[ic]Hello LG.[/ic]
Shows as:
[ic]Hello LG[/ic]

[ic]Hello. LG.[/ic]
Shows as:
[ic]Hello. LG[/ic]

You have to then edit the post to add in the full stop..
LGforumLGforum
Status : Working to restore AWC!

Posts : 2806
Join date : 2011-10-05
Age : 30
Location : UK
Thu 13 Jun 2013, 20:03
Have you definitely done this:
LGforum wrote:[quotelink="http://www.avacweb.com/t1351-new-editor-fixing-and-removing-wysiwyg#12883"]And right at the start before everything else add this: my_setcookie('WYSIWYG_STATE', 0, true);

As that will turn off WYSIWYG globally. Just make sure it right at the top of the javascript file and in all pages. As in right at the top, not in a dom ready function or anything.

You'r second issue should be able to be fixed by changing this line: [ic]sc ? sc.bind('keypress', sc.updateOriginal) : setTimeout(fix_it, 200); [/ic]
To this:
Code:
[panda=js]if(sc) {
    sc.bind('keypress', sc.updateOriginal);
    sc.blur(sc.updateOriginal);
}
else {
    setTimeout(fix_it, 200);
}
NeymarNeymar
Status : No status yet...

Posts : 301
Join date : 2012-03-11
Location : Glasgow, Scotland
Thu 13 Jun 2013, 20:20
LGforum wrote:[quotelink="http://www.avacweb.com/t1351-new-editor-fixing-and-removing-wysiwyg#12913"]Have you definitely done this:
LGforum wrote:[quotelink="http://www.avacweb.com/t1351-new-editor-fixing-and-removing-wysiwyg#12883"]And right at the start before everything else add this: my_setcookie('WYSIWYG_STATE', 0, true);

As that will turn off WYSIWYG globally. Just make sure it right at the top of the javascript file and in all pages. As in right at the top, not in a dom ready function or anything.

You'r second issue should be able to be fixed by changing this line: [ic]sc ? sc.bind('keypress', sc.updateOriginal) : setTimeout(fix_it, 200); [/ic]
To this:
Code:
[panda=js]if(sc) {
    sc.bind('keypress', sc.updateOriginal);
    sc.blur(sc.updateOriginal);
}
else {
    setTimeout(fix_it, 200);
}

I'm going to be honest, I didn't see that... that was stupid of me. Sad Seems like it works now.

And that seems to have fixed the other problem. What is the timeout doing out of interest?
Ch@lo ValdezCh@lo Valdez
Status : :)

Posts : 218
Join date : 2013-04-21
Age : 48
Location : Mexico City
Thu 13 Jun 2013, 23:38
with the tag system not works
AthazelAthazel
Status : No status yet...

Posts : 60
Join date : 2013-02-24
Age : 30
Fri 14 Jun 2013, 08:53
hmmm is there a way to turn off by default the WYSIWYG mode?
I don't want to remove it maybe some people want to use it but I want by default to be off not on
angel_of_nightangel_of_night
Status : No status yet...

Posts : 36
Join date : 2013-03-29
Fri 14 Jun 2013, 13:09
Athazel wrote:[quotelink="http://www.avacweb.com/t1351-new-editor-fixing-and-removing-wysiwyg#12924"]hmmm is there a way to turn off by default the WYSIWYG mode?
I don't want to remove it maybe some people want to use it but I want by default to be off not on
I want this as well.
NeymarNeymar
Status : No status yet...

Posts : 301
Join date : 2012-03-11
Location : Glasgow, Scotland
Fri 14 Jun 2013, 14:56
Athazel wrote:[quotelink="http://www.avacweb.com/t1351-new-editor-fixing-and-removing-wysiwyg#12924"]hmmm is there a way to turn off by default the WYSIWYG mode?
I don't want to remove it maybe some people want to use it but I want by default to be off not on

You would use this then, I think.

Code:
[panda=js]my_setcookie('WYSIWYG_STATE', 0, true);

$(function() {
  var ta = document.getElementById('text_editor_textarea');
  if(ta && document.post) {
      var fix_it = function() {
        var sc = $(ta).data('sceditor');
    if(sc) {
      sc.bind('keypress', sc.updateOriginal);
      sc.blur(sc.updateOriginal);
    }
  else {
    setTimeout(fix_it, 200);
    } 
      };
      fix_it();
  }
});
LeoLeo
Status : No status yet...

Posts : 194
Join date : 2012-05-10
Age : 26
Fri 14 Jun 2013, 17:57
Is my reply box supposed to look the same after this? Cause it does.
BloodbathBloodbath
Status : No status yet...

Posts : 745
Join date : 2013-05-31
Age : 28
Fri 14 Jun 2013, 18:20
@Neymar
I'm not LGforum but I can answer your question nevertheless.

The setTimeout is part of the ternary operator "? : " which works like an if {} else {} construct.
So, basically, fix_it() is trying to either directly apply the changes in the first part or to recursively call itself again until the final state has been reached, as in, when the editor is fixed.

Good job, LG, you saved me some trouble trying to reinstate the old editor completely (I will still be doing that, though) Smile
RukiafanRukiafan
Status : No status yet...

Posts : 533
Join date : 2012-07-20
Fri 14 Jun 2013, 18:43
Can the button JS be changed so the editor buttons appear on mobile browsers or Gaming console browsers?
AthazelAthazel
Status : No status yet...

Posts : 60
Join date : 2013-02-24
Age : 30
Fri 14 Jun 2013, 20:12
Neymar wrote:[quotelink="http://www.avacweb.com/t1351-new-editor-fixing-and-removing-wysiwyg#12927"]
Athazel wrote:[quotelink="http://www.avacweb.com/t1351-new-editor-fixing-and-removing-wysiwyg#12924"]hmmm is there a way to turn off by default the WYSIWYG mode?
I don't want to remove it maybe some people want to use it but I want by default to be off not on

You would use this then, I think.

Code:
[panda=js]my_setcookie('WYSIWYG_STATE', 0, true);

$(function() {
  var ta = document.getElementById('text_editor_textarea');
  if(ta && document.post) {
      var fix_it = function() {
        var sc = $(ta).data('sceditor');
    if(sc) {
      sc.bind('keypress', sc.updateOriginal);
      sc.blur(sc.updateOriginal);
    }
  else {
    setTimeout(fix_it, 200);
    } 
      };
      fix_it();
  }
});

yup it works thank you =)
NeymarNeymar
Status : No status yet...

Posts : 301
Join date : 2012-03-11
Location : Glasgow, Scotland
Fri 14 Jun 2013, 21:29
Ultron's Vision wrote:[quotelink="http://www.avacweb.com/t1351-new-editor-fixing-and-removing-wysiwyg#12935"]@Neymar
I'm not LGforum but I can answer your question nevertheless.

The setTimeout is part of the ternary operator "? : " which works like an if {} else {} construct.
So, basically, fix_it() is trying to either directly apply the changes in the first part or to recursively call itself again until the final state has been reached, as in, when the editor is fixed.

Good job, LG, you saved me some trouble trying to reinstate the old editor completely (I will still be doing that, though) Smile

Hmm I think I know what you mean. Thanks. Smile
LGforumLGforum
Status : Working to restore AWC!

Posts : 2806
Join date : 2011-10-05
Age : 30
Location : UK
Sat 15 Jun 2013, 01:01
If you also want to remove the WYSIWYG mode (since it can cause a lot of stress when using the editor) then make these adjustments to the code above.
After this line: [ic]sc ? sc.bind('keypress', sc.updateOriginal) : setTimeout(fix_it, 200);[/ic] add this: [ic]$('.sceditor-button-source', ta.nextSibling).remove();[/ic]
And right at the start before everything else add this: [ic]my_setcookie('WYSIWYG_STATE', 0, true);[/ic]

Then you've fixed the editor and got rid of the WYSIWYG mode.
^ from the first post.
Removing the wysiwyg mode is explained clearly in the first post. You simply have to make a few additions to the "fixing" code. You don't have to add any more codes or duplicate it, just make two simple adjustments to the code that fixes the editor.
LeoLeo
Status : No status yet...

Posts : 194
Join date : 2012-05-10
Age : 26
Sat 15 Jun 2013, 02:00
LGforum wrote:[quotelink="http://www.avacweb.com/t1351-new-editor-fixing-and-removing-wysiwyg#12947"]
If you also want to remove the WYSIWYG mode (since it can cause a lot of stress when using the editor) then make these adjustments to the code above.
After this line: [ic]sc ? sc.bind('keypress', sc.updateOriginal) : setTimeout(fix_it, 200);[/ic] add this: [ic]$('.sceditor-button-source', ta.nextSibling).remove();[/ic]
And right at the start before everything else add this: [ic]my_setcookie('WYSIWYG_STATE', 0, true);[/ic]

Then you've fixed the editor and got rid of the WYSIWYG mode.
^ from the first post.
Removing the wysiwyg mode is explained clearly in the first post. You simply have to make a few additions to the "fixing" code. You don't have to add any more codes or duplicate it, just make two simple adjustments to the code that fixes the editor.

I did that. But my text editor still looks the same.
NeymarNeymar
Status : No status yet...

Posts : 301
Join date : 2012-03-11
Location : Glasgow, Scotland
Sat 15 Jun 2013, 07:15
Leo wrote:[quotelink="http://www.avacweb.com/t1351-new-editor-fixing-and-removing-wysiwyg#12949"]
LGforum wrote:[quotelink="http://www.avacweb.com/t1351-new-editor-fixing-and-removing-wysiwyg#12947"]
If you also want to remove the WYSIWYG mode (since it can cause a lot of stress when using the editor) then make these adjustments to the code above.
After this line: [ic]sc ? sc.bind('keypress', sc.updateOriginal) : setTimeout(fix_it, 200);[/ic] add this: [ic]$('.sceditor-button-source', ta.nextSibling).remove();[/ic]
And right at the start before everything else add this: [ic]my_setcookie('WYSIWYG_STATE', 0, true);[/ic]

Then you've fixed the editor and got rid of the WYSIWYG mode.
^ from the first post.
Removing the wysiwyg mode is explained clearly in the first post. You simply have to make a few additions to the "fixing" code. You don't have to add any more codes or duplicate it, just make two simple adjustments to the code that fixes the editor.

I did that. But my text editor still looks the same.

It will look the same, but the switch editor mode button will be gone and it will break less.
avatarsyndicate
Status : No status yet...

Posts : 2
Join date : 2011-12-08
Sat 15 Jun 2013, 18:55
Sorry for the trouble and i know Avacweb has stated that most of the previous codes should be working after this fix. But can anyone confirm that the quick quote feature works after adding this fix?

Thanks
AconitinAconitin
Status : No status yet...

Posts : 115
Join date : 2012-09-17
Location : Earth
Wed 19 Jun 2013, 06:07
Thanks, LG.
It works for some scripts..
But the following scripts below still doesn't work.

New Text Editor Button
Code:
[panda=js](function(){var f={add:function(c,d,b){$(function(){if(document.getElementById("html_edit")){void 0==b&&(b="");var a=document.createElement("span");a.innerHTML='<button class="button2" style="height: 22px; margin-right: 5px;" onClick="bbfontstyle(\''+d+"', '"+b+"'); return false;\">"+c+"</button>";document.getElementById("new_buttons_area").appendChild(a)}})},list:function(c,d,b){$(function(){if(document.getElementById("text_edit")){var a=document.createElement("span");a.innerHTML='<input type="button" style="height: 22px; margin-right: 5px;" value="'+ c+'" onclick="selectWysiwyg(this, \''+b+'\');" class="button2">';document.getElementById("new_buttons_area").appendChild(a);a=document.createElement("div");a.id=b;a.className="select";a.style.visibility="hidden";for(var e in d)a.innerHTML=/,/.test(d[e])?a.innerHTML+("<button onmouseout=\"this.className='';\" onmouseover=\"this.className='selectHover';\" onclick=\"bbfontstyle('"+d[e].replace(/(.*),.*/,"$1")+"', '"+d[e].replace(/.*,(.*)/,"$1")+"');selectWysiwyg(this, '"+b+"');return false;\">"+e+"</button><br>"): a.innerHTML+("<button onmouseout=\"this.className='';\" onmouseover=\"this.className='selectHover';\" onclick=\"bbfontstyle('"+d[e]+"', '');selectWysiwyg(this, '"+b+"');return false;\">"+e+"</button><br>");document.getElementById("text_editor_select_controls").appendChild(a)}})},init:function(){$(function(){if(document.getElementById("html_edit")){var c=document.createElement("div");c.id="new_buttons_area";c.style.paddingTop="5px";document.getElementById("html_edit").parentNode.insertBefore(c,document.getElementById("html_edit").nextSibling)}})}}; window.buttons=f;f.init()})();
        buttons.list('Effect', {
    'Box': '[ic],[/ic]',
    'Blur': '[blur],[/blur]',
    'Fade': '[fade],[/fade]',
    'Blink': '[blink],[/blink]',
    'Flip Hor': '[fliph],[/fliph]',
    'Flip Ver': '[flipv],[/flipv]',
    'Shadow': '[shadow],[/shadow]',
    'New Quote': '[nquote],[/nquote]'
    }, 'bbcode_list_1');   
Tutorial : http://www.avacweb.com/t993-how-to-create-a-new-text-editor-button

Default Text in Text Editor Area
Code:
[panda=js]$(document).ready(function(){ 
    if (document.getElementById('text_editor_textarea')) 
    document.getElementById('text_editor_textarea').placeholder = "Leave your comment here."; 
    });
Tutorial : At fmQuery but I can't find that topic in AvacWeb..

Character's Counter
Code:
[panda=html]    <script>
    jQuery(document).ready(function() {
    jQuery('#text_editor_textarea').before('<p>Characters Used: <span id="post_count">-</span> of 65,000; Number of characters left: <span id="post_recoursive">-</span>;</p>').keyup(function() {
    tet = jQuery('#text_editor_textarea').val();
    jQuery('#post_count').html(tet.length);
    jQuery('#post_recoursive').html(65000- tet.length);
    });
    });
    </script>
Tutorial : http://help.forumotion.com/t88670p30-users-tuesday-tips-add-a-counter-to-the-quick-reply-extended-reply-pm-s-the-signature-by-darren

Can someone help me?
AconitinAconitin
Status : No status yet...

Posts : 115
Join date : 2012-09-17
Location : Earth
Mon 24 Jun 2013, 06:15
Up, up, up..
BloodbathBloodbath
Status : No status yet...

Posts : 745
Join date : 2013-05-31
Age : 28
Mon 24 Jun 2013, 06:28
The old editor and the new editor aren't compatible with each other so you cannot use buttons from one editor for the other, I'm afraid.
AconitinAconitin
Status : No status yet...

Posts : 115
Join date : 2012-09-17
Location : Earth
Tue 02 Jul 2013, 12:23
Ultron's Vision wrote:[quotelink="http://www.avacweb.com/t1351p15-new-editor-fixing-and-removing-wysiwyg#13174"]The old editor and the new editor aren't compatible with each other so you cannot use buttons from one editor for the other, I'm afraid.

So, what should I do?
I want to use those codes.. Sad
RukiafanRukiafan
Status : No status yet...

Posts : 533
Join date : 2012-07-20
Tue 02 Jul 2013, 18:16
Hey guys I just wanted to let you know that there is a leftover fragment of the old editor in the message body template for PunBB so it should be possible to restore the old editor with enough time and effort. Wink
AconitinAconitin
Status : No status yet...

Posts : 115
Join date : 2012-09-17
Location : Earth
Fri 05 Jul 2013, 07:05
Up up..
LGforumLGforum
Status : Working to restore AWC!

Posts : 2806
Join date : 2011-10-05
Age : 30
Location : UK
Fri 05 Jul 2013, 10:01
Wait for new codes for the new editor to pop up around the place.
AconitinAconitin
Status : No status yet...

Posts : 115
Join date : 2012-09-17
Location : Earth
Fri 05 Jul 2013, 15:24
LGforum wrote:[quotelink="http://www.avacweb.com/t1351p15-new-editor-fixing-and-removing-wysiwyg#13610"]Wait for new codes for the new editor to pop up around the place.
I can wait, LG.. Thank you Razz
Sponsored content

 • Previous Topic • Next Topic