Skip to content

Commit

Permalink
Attempt at #127
Browse files Browse the repository at this point in the history
  • Loading branch information
etcook committed Sep 10, 2014
1 parent 7d4ac3b commit 4adf2ca
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
7 changes: 6 additions & 1 deletion admin/assets/js/tinymce/aiview/plugin.js
Expand Up @@ -14,15 +14,20 @@ tinymce.PluginManager.add('aiview', function( editor ) {
// let's pull out the shortcode type, options and content
var re_full = /\[aesop_([a-zA-Z_]+)\s([^\[\]]*)]([^\[\]]+)\[\/aesop_[a-zA-Z_]+]/g;
var re_short = /\[aesop_([a-zA-Z_]+)\s?([^\[\]]*)]/g;
// let's clear the line break we added on items that were already parsed as p
var re_cleaner = /(<\/p>[\s]*<p><\/p>\s<p>)[\s]*$/;
// let's fix the closing tag on those items without a forced line break
var re_cleaner_short = /(<\/p>[\s]*<p>)[\s]*$/;

var parse = re_full.exec(data);

if ( !parse ){
parse = re_short.exec(data);
var st = '<div data-mce-resize="false" data-mce-placeholder="1" data-aesop-sc="' + window.encodeURIComponent( data ) + '" class="mceItem aesop-component-short ' + cls + '"><div class="aesop-component-mask"></div><div class="aesop-component-bar" contenteditable="false"><div class="aesop-component-controls"><div title="Delete Component" class="aesop-button aesop-button-delete">&nbsp;</div><div title="Edit Component" class="aesop-button aesop-button-edit aesop-scope-' + parse[1] + '">&nbsp;</div><div title="Cut Component / CTRL + ALT + ENTER to Paste" class="aesop-button aesop-button-clipboard">&nbsp;</div></div><span class="mceNonEditable aesop-component-title unselectable aesop-' + parse[1] + '-title">' + parse[1].replace(/_/g, " ") + '</span></div><div class="aesop-end">WcMgcq</div></div>';
} else {
parse[3] = parse[3].replace( re_cleaner, '');
parse[3] = parse[3].replace( re_cleaner_short, '');
var st = '<div data-mce-resize="false" data-mce-placeholder="1" data-aesop-sc="' + window.encodeURIComponent( data ) + '" class="mceItem aesop-component-long ' + cls + '"><div class="aesop-component-mask"></div><div class="aesop-component-bar" contenteditable="false"><div class="aesop-component-controls"><div title="Delete Component" class="aesop-button aesop-button-delete">&nbsp;</div><div title="Edit Component" class="aesop-button aesop-button-edit aesop-scope-' + parse[1] + '">&nbsp;</div><div title="Cut Component / CTRL + ALT + ENTER to Paste" class="aesop-button aesop-button-clipboard">&nbsp;</div></div><span class="mceNonEditable aesop-component-title unselectable aesop-' + parse[1] + '-title">' + parse[1].replace(/_/g, " ") + '</span></div><div class="aesop-component-content aesop-' + parse[1] + '"><p>' + parse[3] + '</p></div></div>';
//console.log(st);
}

return st;
Expand Down
3 changes: 2 additions & 1 deletion admin/assets/js/tinymce/aiview/plugin.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4adf2ca

Please sign in to comment.