Permalink
Browse files

* Added bbPress support.

* Integrated Tag Editor with Fancybox, switched from the discontinued ThickBox, a fair amount of changes took place.
* Crayon should now appear pretty much anywhere TinyMCE does, and this can be tweaked to add more options later.
  • Loading branch information...
aramk committed Sep 7, 2012
1 parent e774076 commit 6f204aaa6d3c3ef1fc90512cc362f5562b91527b
@@ -548,7 +548,7 @@ public static function metrics() {
echo '<div id="crayon-subsection-float">';
self::checkbox(array(CrayonSettings::FLOAT_ENABLE, crayon__('Allow floating elements to surround Crayon')), FALSE, FALSE);
echo '</div>';
echo '<span class="crayon-span-100">' . crayon__('Inline Margin') . '</span>';
echo '<span class="crayon-span-100">' . crayon__('Inline Margin') . ' </span>';
self::textbox(array('id' => CrayonSettings::INLINE_MARGIN, 'size' => 2));
echo '<span class="crayon-span-margin">', crayon__('Pixels'), '</span>';
echo '</div>';
View
@@ -3,7 +3,7 @@
Plugin Name: Crayon Syntax Highlighter
Plugin URI: http://ak.net84.net/projects/crayon-syntax-highlighter
Description: Supports multiple languages, themes, highlighting from a URL, local file or post text.
Version: _1.10.2_beta
Version: _1.11_beta
Author: Aram Kocharyan
Author URI: http://ak.net84.net/
Text Domain: crayon-syntax-highlighter
@@ -104,7 +104,7 @@ public static function regex_no_capture() {
}
/**
* Adds the actual Crayon instance, should only be called by add_shortcode()
* Adds the actual Crayon instance.
* $mode can be: 0 = return crayon content, 1 = return only code, 2 = return only plain code
*/
public static function shortcode($atts, $content = NULL, $id = NULL) {
@@ -176,21 +176,26 @@ public static function highlight($code) {
$crayon_str = '';
$captures = CrayonWP::capture_crayons(0, $code);
$captures = $captures['capture'];
foreach ($captures as $capture) {
//var_dump($captures);
$the_captures = $captures['capture'];
$the_content = $captures['content'];
foreach ($the_captures as $capture) {
$id = $capture['id'];
$atts = $capture['atts'];
$no_enqueue = array(
CrayonSettings::ENQUEUE_THEMES => FALSE,
CrayonSettings::ENQUEUE_FONTS => FALSE);
$atts = array_merge($atts, $no_enqueue);
$content = $capture['code'];
$crayon = CrayonWP::shortcode($atts, $content, $id);
$code = $capture['code'];
$crayon = CrayonWP::shortcode($atts, $code, $id);
$crayon_formatted = $crayon->output(TRUE, FALSE);
$crayon_str .= $crayon_formatted;
$the_content = CrayonUtil::preg_replace_escape_back(self::regex_with_id($id), $crayon_formatted, $the_content, 1, $count);
//$crayon_str .= $crayon_formatted;
}
//var_dump($the_content); exit;
return $crayon_str;
return $the_content;
}
/* Uses the main query */
@@ -444,8 +449,8 @@ private static function enqueue_resources() {
CrayonLog::debug('enqueue');
global $CRAYON_VERSION;
wp_enqueue_style('crayon_global_style', plugins_url(CRAYON_STYLE_GLOBAL, __FILE__), array(), $CRAYON_VERSION);
wp_enqueue_style('crayon_style', plugins_url(CRAYON_STYLE, __FILE__), array(), $CRAYON_VERSION);
wp_enqueue_style('crayon_global_style', plugins_url(CRAYON_STYLE_GLOBAL, __FILE__), array(), $CRAYON_VERSION);
wp_enqueue_script('crayon_util_js', plugins_url(CRAYON_JS_UTIL, __FILE__), array('jquery'), $CRAYON_VERSION);
wp_enqueue_script('crayon_js', plugins_url(CRAYON_JS, __FILE__), array('jquery', 'crayon_util_js'), $CRAYON_VERSION);
wp_enqueue_script('crayon_jquery_popup', plugins_url(CRAYON_JQUERY_POPUP, __FILE__), array('jquery'), $CRAYON_VERSION);
@@ -836,6 +841,10 @@ public static function post_get_excerpt($e) {
return $e;
}
public static function test($content) {
return CrayonWP::highlight($content);
}
}
// Only if WP is loaded and not in admin
@@ -857,6 +866,10 @@ public static function post_get_excerpt($e) {
// XXX Some themes like to play with the content, make sure we replace after they're done
add_filter('the_content', 'CrayonWP::the_content', 100);
// add_filter('the_content', 'CrayonWP::test');
add_filter( 'bbp_get_reply_content', 'CrayonWP::test', 100);
if (CrayonGlobalSettings::val(CrayonSettings::COMMENTS)) {
/* XXX This is called first to match Crayons, then higher priority replaces after other filters.
Prevents Crayon from being formatted by the filters, and also keeps original comment formatting. */
View
@@ -1,23 +1,87 @@
/* TinyMCE */
.crayon-te *,#crayon-te-bar-content {
font-family: "Lucida Grande", Verdana, Arial, sans-serif !important;
font-size: 12px;
}
#crayon-te-content,
#crayon-te-table {
.crayon-te input[type="text"],.crayon-te textarea {
background: #F9F9F9;
border: 1px solid #CCC;
box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.1);
-moz-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.1);
padding: 2px 4px;
-webkit-border-radius: 3px;
border-radius: 3px;
border-width: 1px;
border-style: solid;
}
#crayon-te-content,#crayon-te-table {
width: 100%;
height: auto !important;
}
#crayon-te-table th,
#crayon-te-table td {
#crayon-range,#crayon-mark {
width: 100px;
}
#crayon-te-table th,#crayon-te-table td {
vertical-align: top;
text-align: left;
}
#crayon-te-table .crayon-tr-center td,
#crayon-te-table .crayon-tr-center th {
#crayon-te-table .crayon-tr-center td,#crayon-te-table .crayon-tr-center th
{
vertical-align: middle;
}
#crayon-te-table .crayon-nowrap {
white-space: nowrap;
}
#crayon-te-bar-content {
border: 1px solid #666;
border-bottom: none;
height: 26px;
line-height: 25px;
padding: 0px 8px;
padding-right: 0;
background-color: #222;
color: #CFCFCF;
}
#crayon-te-bar-content a {
line-height: 25px;
padding: 5px 10px;
color: #DDD;
font-weight: bold;
text-decoration: none !important;
}
#crayon-te-bar-content a:hover {
color: #FFF;
}
.crayon-te-seperator {
color: #666;
margin: 0;
padding: 0;
}
#crayon-te-bar-block {
height: 34px;
width: 100%;
}
#crayon-te-title {
float: left;
}
#crayon-te-controls {
float: right;
}
#crayon-url-th {
vertical-align: top !important;
padding-top: 5px;
@@ -28,6 +92,10 @@
font-weight: bold;
}
#crayon-te-settings-info {
text-align: center;
}
.crayon-te-section {
font-weight: bold;
padding: 0 10px;
@@ -36,46 +104,47 @@
#crayon-te-sub-section {
margin-left: 10px;
}
#crayon-te-sub-section .crayon-te-section {
font-weight: normal;
padding: 0;
}
#crayon-code {
width: 100% !important;
height: 200px;
white-space: pre;
/*white-space: nowrap;
overflow: auto;*/
}
#crayon-url {
width: 100% !important;
#crayon-code,#crayon-url {
width: 555px !important;
}
.crayon-disabled {
background: #EEE !important;
}
.mce_crayon_tinymce_highlight,
.qt_crayon_highlight {
.mce_crayon_tinymce_highlight,.qt_crayon_highlight {
border: 1px solid #7c9dde !important;
}
.qt_crayon_highlight {
background-image: -ms-linear-gradient(bottom,#daf2ff,white) !important;
background-image: -moz-linear-gradient(bottom,#daf2ff,white) !important;
background-image: -o-linear-gradient(bottom,#daf2ff,white) !important;
background-image: -webkit-linear-gradient(bottom,#daf2ff,white) !important;
background-image: linear-gradient(bottom,#daf2ff,white) !important;
background-image: -ms-linear-gradient(bottom, #daf2ff, white) !important;
background-image: -moz-linear-gradient(bottom, #daf2ff, white)
!important;
background-image: -o-linear-gradient(bottom, #daf2ff, white) !important;
background-image: -webkit-linear-gradient(bottom, #daf2ff, white)
!important;
background-image: linear-gradient(bottom, #daf2ff, white) !important;
}
.qt_crayon_highlight:hover{
background:#ddebf2 !important;
.qt_crayon_highlight:hover {
background: #ddebf2 !important;
}
.mce_crayon_tinymce_highlight span.mce_crayon_tinymce,
.wp_themeSkin .mceButtonEnabled:hover span.mce_crayon_tinymce, .wp_themeSkin .mceButtonActive span.mce_crayon_tinymce {
.mce_crayon_tinymce_highlight span.mce_crayon_tinymce,.wp_themeSkin .mceButtonEnabled:hover span.mce_crayon_tinymce,.wp_themeSkin .mceButtonActive span.mce_crayon_tinymce
{
background-position: -20px 0;
}
@@ -89,14 +158,13 @@
width: 100px;
}
/*#crayon-te-table span {
margin-left: 4px;
}*/
#crayon-te-clear {
margin-left: 10px;
color: #666;
background-color: #f4f4f4;
border: 1px solid #CCC;
border-radius: 3px;
margin-left: 8px;
}
#crayon-title {
@@ -107,9 +175,8 @@
overflow: auto !important;
}
#TB_window.crayon-te-ajax,
#TB_window.crayon-te-ajax #TB_ajaxContent,
#TB_window.crayon-te-ajax #TB_title {
#TB_window.crayon-te-ajax,#TB_window.crayon-te-ajax #TB_ajaxContent,#TB_window.crayon-te-ajax #TB_title
{
width: 680px !important;
}
@@ -176,8 +243,7 @@
}
.crayon-setting-changed,
.crayon-setting-selected {
.crayon-setting-changed,.crayon-setting-selected {
background: #fffaad !important;
}
@@ -201,4 +267,4 @@
.wp_themeSkin span.mce_crayon_tinymce {
background: url(images/crayon_tinymce.png);
}
}
View
@@ -71,6 +71,8 @@
define('CRAYON_JS_ADMIN', CRAYON_JS_DIR . 'crayon_admin.js');
define('CRAYON_JS_UTIL', CRAYON_JS_DIR . 'util.js');
define('CRAYON_CSSJSON_JS', CRAYON_JS_DIR . 'cssjson.js');
define('CRAYON_JS_FANCYBOX', CRAYON_JS_DIR . 'fancybox/jquery.fancybox.pack.js');
define('CRAYON_CSS_FANCYBOX', CRAYON_JS_DIR . 'fancybox/jquery.fancybox.css');
// TODO rename TE
define('CRAYON_TE_JS', 'crayon_te.js');
define('CRAYON_TE_PHP', CRAYON_TAG_EDITOR_PATH . 'crayon_tag_editor_wp.class.php');
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.

0 comments on commit 6f204aa

Please sign in to comment.