WordPress.org

Plugin Directory

Changeset 593487


Ignore:
Timestamp:
09/01/12 18:37:58 (20 months ago)
Author:
MarcusPope
Message:

added support for javascript block tags

Location:
preserved-html-editor-markup/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • preserved-html-editor-markup/trunk/admin.js

    r590703 r593487  
    249249        $('body').bind('afterPreWpautop', function(e, o) { 
    250250            //On Switch to HTML & On save/update from Visual tab 
    251              
    252251            //Now we replace all those temporary html comments with spaces and newlines 
    253             o.data = o.unfiltered.replace(/<\!--mep-nl-->/g, "\r\n").replace(/<\!--mep-tab-->/g, "    "); 
     252            o.data = o.unfiltered; 
     253            
     254            //remove cdata tags that are injected by browser, they can also malform mep tags 
     255            o.data = o.data.replace(/\/\/ <!\[CDATA\[/g, ""); 
     256            o.data = o.data.replace(/[^-]mep-nl-->/g, "<!--mep-nl-->"); //fix new lines before and after script tags 
     257            o.data = o.data.replace(/<!--mep-nl[^-]/g, "<!--mep-nl-->");  
     258            o.data = o.data.replace(/<!--mep-tab[^-]/g, "<!--mep-tab-->"); //corner case, user adds four spaces after an opening script tag... not likely 
     259            o.data = o.data.replace(/[^-]mep-tab-->/g, "<!--mep-tab-->");  //fix script blocks that are fully indented 
     260            o.data = o.data.replace(/\/\/ \]\]>/g, ""); 
     261             
     262            //now decode newlines and tabs 
     263            o.data = o.data.replace(/<\!--mep-nl-->/g, "\r\n").replace(/<\!--mep-tab-->/g, "    "); 
    254264             
    255265            //Fix broken >, <, &, etc symbols when they exist inside quote marks inside tag elements 
     
    258268            o.data = fix_intra_tag_content("&lt;", o.data, "{-mep-lts}"); 
    259269            o.data = fix_intra_tag_content("&#8221;", o.data, "{-mep-dbl-quote}", '"');  
    260             o.data = fix_intra_tag_content("&#8243;", o.data, "{-mep-dbl-quote}", '"');  
     270            o.data = fix_intra_tag_content("&#8243;", o.data, "{-mep-dbl-quote}", '"'); 
     271             
     272            //fix >, < last because `fix_intra_tag_content` relies on their symbol placement 
    261273            o.data = o.data.replace(/{-mep-gts}/g, '>'); 
    262274            o.data = o.data.replace(/{-mep-lts}/g, '<'); 
  • preserved-html-editor-markup/trunk/readme.txt

    r591398 r593487  
    77Stable tag: trunk 
    88 
    9 Preserves white space and developer edits in HTML tab AND WYSIWYG tab and adds support for HTML5 block anchor tags 
     9Preserves white space and developer edits in HTML tab AND WYSIWYG tab.  Allows inline scripts and css, full JavaScript code blocks and adds support for HTML5 block anchor tags 
    1010 
    1111== Description == 
     
    1515It also supports HTML5 Block Anchor tags, something that is currently not supported in WP even via any existing plugins. 
    1616 
    17 Version 1.4 is just a minor patch release.  User @denl noticed a problem with the plugin CataBlog which implements its own administrative management features by disabling the 'show_ui' flag for its custom post type.  I was ignoring any custom post type that didn't have a GUI, but it was an unecessary filter that probably limited other plugins.  This fix allows any post type that supports the TinyMCE editor to be "fixed" using the tools under Admin > Settings > Writing. 
     17Version 1.5 will probably be the last version I release for a while since my daughter will be born soon.  I've added support for full JavaScript code blocks in the HTML tab.  They are compatible and preserved when switching to Visual mode.  This rounds out the support for almost complete html preservation, with full use of the WYSIWYG editor. And you don't need to wrap comment codes around it per the recommendations located here: <http://codex.wordpress.org/Using_Javascript> but you can leave them in if you want. 
     18 
     19Version 1.4 was just a minor patch release.  User @denl noticed a problem with the plugin CataBlog which implements its own administrative management features by disabling the 'show_ui' flag for its custom post type.  I was ignoring any custom post type that didn't have a GUI, but it was an unecessary filter that probably limited other plugins.  This fix allows any post type that supports the TinyMCE editor to be "fixed" using the tools under Admin > Settings > Writing. 
    1820 
    1921Since version 1.3 you can now use inline CSS and JavaScript in the HTML editor and everything should be preserved.  To be clear, this applies to tags only, like `onclick` events and style definitions - not script blocks themselves.  To enable this feature you must disable the `wptexturize` and `convert_chars` filters by adding the following code to your theme's `functions.php`: 
     
    4143The caveats that still remains are: 
    4244 
     45  1. With script blocks added to your HTML markup, the right arrow key does not pass over them in the Visual Tab.  You can down arrow over them however so this will likely never be addressed. 
     46   
    4347  1. If you use the Paragraph tag setting for newlines there is a minor bug where it will only wrap your content in Paragraph tags if you specify Paragraph in the Format drop down or if you enter more than one paragraph of text.  So if you just type one sentence and click save it will not wrap the content in Paragraph tags.  I tried to fix this but ran out of my allotted time working on other core issues.  Should be fixed in the next release. 
    4448   
  • preserved-html-editor-markup/trunk/sb_preserved_markup.php

    r591398 r593487  
    88Author: Marcus E. Pope, marcuspope 
    99Author URI: http://www.marcuspope.com 
    10 Version: 1.4 
     10Version: 1.5 
    1111 
    1212Copyright 2011 Marcus E. Pope (email : me@marcuspope.com) 
Note: See TracChangeset for help on using the changeset viewer.