Skip to content
Permalink
Browse files

Merge branch 't/11788b'

  • Loading branch information...
pjasiun committed May 6, 2014
2 parents c4a1982 + e16d9d6 commit 535d87febb33a269e34091d12f9192a68cab82a7
Showing 306 changed files with 85,914 additions and 10 deletions.
@@ -18,6 +18,7 @@ Fixed Issues:
* [#11880](http://dev.ckeditor.com/ticket/11880): Fixed: [IE8-9] Linked image has a default thick border.
* [#11822](http://dev.ckeditor.com/ticket/11822): Fixed: [Webkit] Anchors editing by double click broken in some cases.
* [#11823](http://dev.ckeditor.com/ticket/11823): [IE8] Fixed: [Table Resize](http://ckeditor.com/addon/tableresize) throws error over scrollbar.
* [#11788](http://dev.ckeditor.com/ticket/11788): Fixed: It is not possible to change language back to undefined in [Code Snippet](http://ckeditor.com/addon/codesnippet) dialog.

Other changes:

@@ -11,15 +11,13 @@
lang = editor.lang.codesnippet,
clientHeight = document.documentElement.clientHeight,
langSelectItems = [],
langSelectDefaultValue,
snippetLangId;

langSelectItems.push( [ editor.lang.common.notSet, '' ] );

for ( snippetLangId in snippetLangs )
langSelectItems.push( [ snippetLangs[ snippetLangId ], snippetLangId ] );

if ( langSelectItems.length )
langSelectDefaultValue = langSelectItems[ 0 ][ 1 ];

// Size adjustments.
var size = CKEDITOR.document.getWindow().getViewPaneSize(),
// Make it maximum 800px wide, but still fully visible in the viewport.
@@ -43,9 +41,9 @@
type: 'select',
label: lang.language,
items: langSelectItems,
'default': langSelectDefaultValue,
setup: function( widget ) {
this.setValue( widget.ready ? widget.data.lang : '' );
if ( widget.ready && widget.data.lang )
this.setValue( widget.data.lang );

// The only way to have an empty select value in Firefox is
// to set a negative selectedIndex.
@@ -318,15 +318,15 @@
if ( newData.code )
this.parts.code.setHtml( CKEDITOR.tools.htmlEncode( newData.code ) );

// Remove old .language-* class.
if ( oldData && newData.lang != oldData.lang )
this.parts.code.removeClass( 'language-' + oldData.lang );

// Lang needs to be specified in order to apply formatting.
if ( newData.lang ) {
// Apply new .language-* class.
this.parts.code.addClass( 'language-' + newData.lang );

// Remove old .language-* class.
if ( oldData && newData.lang != oldData.lang )
this.parts.code.removeClass( 'language-' + oldData.lang );

this.highlight();
}

@@ -420,6 +420,7 @@ CKEDITOR.config.codeSnippet_codeClass = 'hljs';

/**
* Restricts languages available in the "Code Snippet" dialog window.
* Node that the empty value is always added to the list.
*
* **Note**: If using a custom highlighter library (the default is [highlight.js](http://highlightjs.org)),
* you may need to refer to external documentation to set `config.codeSnippet_languages` properly.
@@ -0,0 +1,122 @@
<!DOCTYPE html>
<!--
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
-->
<html>
<head>
<meta charset="utf-8">
<title>Code Snippet &mdash; CKEditor Sample</title>
<script src="../../../ckeditor.js"></script>
<link href="../../../samples/sample.css" rel="stylesheet">
<meta name="ckeditor-sample-name" content="Code Snippet plugin">
<meta name="ckeditor-sample-group" content="Plugins">
<meta name="ckeditor-sample-description" content="View and modify code using the Code Snippet plugin.">
<meta name="ckeditor-sample-isnew" content="1">
<style>
#editable
{
padding: 10px 20px;
}
pre > code {
display: block;
}
</style>
</head>
<body>
<textarea id="editor1">
&lt;p&gt;JavaScript code:&lt;/p&gt;

&lt;pre&gt;
&lt;code class="language-javascript"&gt;function isEmpty( object ) {
for ( var i in object ) {
if ( object.hasOwnProperty( i ) )
return false;
}
return true;
}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;SQL query:&lt;/p&gt;

&lt;pre&gt;
&lt;code class="language-sql"&gt;SELECT cust.id FROM cust LEFT JOIN loc ON ( cust.loc_id = loc.id ) WHERE cust.type IN ( 1, 2 );&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Unknown markup:&lt;/p&gt;

&lt;pre&gt;
&lt;code&gt; ________________
/ \
| How about moo? | ^__^
\________________/ (oo)\_______
\ (__)\ )\/\
||----w |
|| ||
&lt;/code&gt;&lt;/pre&gt;
</textarea>

<h2>Inline editor</h2>

<div id="editable" contenteditable="true">

<p>JavaScript code:</p>

<pre><code class="language-javascript">function isEmpty( object ) {
for ( var i in object ) {
if ( object.hasOwnProperty( i ) )
return false;
}
return true;
}</code></pre>

<p>SQL query:</p>

<pre><code class="language-sql">SELECT cust.id, cust.name, loc.city FROM cust LEFT JOIN loc ON ( cust.loc_id = loc.id ) WHERE cust.type IN ( 1, 2 );</code></pre>

<p>Unknown markup:</p>

<pre><code> ________________
/ \
| How about moo? | ^__^
\________________/ (oo)\_______
\ (__)\ )\/\
||----w |
|| ||
</code></pre>
</div>

<script>
( function() {
CKEDITOR.disableAutoInline = true;
var config = {
extraPlugins: 'codesnippet,codesnippetgeshi',
codeSnippetGeshi_url: 'plugins/codesnippetgeshi/dev/colorize.php',
toolbar: [
[ 'Source', 'Sourcedialog' ], [ 'Undo', 'Redo' ], [ 'Bold', 'Italic', 'Underline' ], [ 'CodeSnippet' ]
],
codeSnippet_theme: 'monokai_sublime',
height: 400
};
CKEDITOR.replace( 'editor1', config );
CKEDITOR.inline( 'editable', CKEDITOR.tools.extend( {}, config, {
extraPlugins: 'codesnippet,codesnippetgeshi,sourcedialog'
}, true ) );
}() );
</script>

<div id="footer">
<hr>
<p>
CKEditor - The text editor for the Internet - <a class="samples" href="http://ckeditor.com/">http://ckeditor.com</a>
</p>
<p id="copy">
Copyright &copy; 2003-2014, <a class="samples" href="http://cksource.com/">CKSource</a> - Frederico
Knabben. All rights reserved.
</p>
</div>
</body>
</html>
@@ -0,0 +1,14 @@
<?php
if ( function_exists( 'stream_resolve_include_path' ) && stream_resolve_include_path( 'geshi/geshi.php' ) === FALSE ) {
die( '<pre class="html">Please install the geshi library. Refer to plugins/codesnippetgeshi/README.md for more information.</pre>' );
}
include_once 'geshi/geshi.php';
$json_string = file_get_contents( 'php://input' );
$json_object = json_decode( $json_string );
$geshi = new GeSHi( $json_object->html, $json_object->lang );
echo $geshi->parse_code();
@@ -0,0 +1,123 @@
<?php
/**
* Another GeSHi example script
*
* Configure your Apache server with 'AcceptPathInfo true' and something like
* 'Alias /viewmysource /var/www/geshi/contrib/aliased.php'. Don't forget
* to protect this alias as necessary.
*
* Usage - visit /viewmysource/file.name.ext to see that file with syntax
* highlighting, where "viewmysource" is the name of the alias you set up.
* You can use this without an alias too, just by visiting
* aliased.php/file.name.ext.
*
* @author Ross Golder <ross@golder.org>
* @version $Id: aliased.php 2533 2012-08-15 18:49:04Z benbe $
*/
// Your config here
define("SOURCE_ROOT", "/var/www/your/source/root/");
// Assume you've put geshi in the include_path already
require_once("geshi.php");
// Get path info
$path = SOURCE_ROOT.$_SERVER['PATH_INFO'];
// Check for dickheads trying to use '../' to get to sensitive areas
$base_path_len = strlen(SOURCE_ROOT);
$real_path = realpath($path);
if(strncmp($real_path, SOURCE_ROOT, $base_path_len)) {
exit("Access outside acceptable path.");
}
// Check file exists
if(!file_exists($path)) {
exit("File not found ($path).");
}
// Prepare GeSHi instance
$geshi = new GeSHi();
$geshi->set_language('text');
$geshi->load_from_file($path);
$geshi->set_header_type(GESHI_HEADER_PRE);
$geshi->enable_classes();
$geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 10);
$geshi->set_overall_style('color: #000066; border: 1px solid #d0d0d0; background-color: #f0f0f0;', true);
$geshi->set_line_style('font: normal normal 95% \'Courier New\', Courier, monospace; color: #003030;', 'font-weight: bold; color: #006060;', true);
$geshi->set_code_style('color: #000020;', 'color: #000020;');
$geshi->set_link_styles(GESHI_LINK, 'color: #000060;');
$geshi->set_link_styles(GESHI_HOVER, 'background-color: #f0f000;');
$geshi->set_header_content('Source code viewer - ' . $path . ' - ' . $geshi->get_language_name());
$geshi->set_header_content_style('font-family: Verdana, Arial, sans-serif; color: #808080; font-size: 70%; font-weight: bold; background-color: #f0f0ff; border-bottom: 1px solid #d0d0d0; padding: 2px;');
$geshi->set_footer_content('Parsed in <TIME> seconds, using GeSHi <VERSION>');
$geshi->set_footer_content_style('font-family: Verdana, Arial, sans-serif; color: #808080; font-size: 70%; font-weight: bold; background-color: #f0f0ff; border-top: 1px solid #d0d0d0; padding: 2px;');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Source code viewer - <?php echo $path; ?> - <?php $geshi->get_language_name(); ?></title>
<style type="text/css">
<!--
<?php
// Output the stylesheet. Note it doesn't output the <style> tag
echo $geshi->get_stylesheet();
?>
html {
background-color: #f0f0f0;
}
body {
font-family: Verdana, Arial, sans-serif;
margin: 10px;
border: 2px solid #e0e0e0;
background-color: #fcfcfc;
padding: 5px;
}
h2 {
margin: .1em 0 .2em .5em;
border-bottom: 1px solid #b0b0b0;
color: #b0b0b0;
font-weight: normal;
font-size: 150%;
}
h3 {
margin: .1em 0 .2em .5em;
color: #b0b0b0;
font-weight: normal;
font-size: 120%;
}
#footer {
text-align: center;
font-size: 80%;
color: #a9a9a9;
}
#footer a {
color: #9999ff;
}
textarea {
border: 1px solid #b0b0b0;
font-size: 90%;
color: #333;
margin-left: 20px;
}
select, input {
margin-left: 20px;
}
p {
font-size: 90%;
margin-left: .5em;
}
-->
</style>
</head>
<body>
<?php
// The fun part :)
echo $geshi->parse_code();
?>
<hr/>
</body>
</html>
Oops, something went wrong.

0 comments on commit 535d87f

Please sign in to comment.
You can’t perform that action at this time.