Skip to content

Commit

Permalink
Several fixes to the editor
Browse files Browse the repository at this point in the history
- Added source edit dialog to inline editor
- Finally fixed the temperamental textcolor and background color buttons
  of the inline editor
- Better Font-Awesome support
  • Loading branch information
torinfo committed Mar 28, 2015
1 parent fd7f933 commit 33a11dc
Show file tree
Hide file tree
Showing 82 changed files with 854 additions and 6 deletions.
18 changes: 15 additions & 3 deletions editor/js/toolbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -751,10 +751,11 @@ var EDITOR = (function ($, parent) {
mathJaxLib : '//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_HTMLorMML-full',
toolbarStartupExpanded : defaultToolBar,
codemirror : codemirroroptions,
extraAllowedContent: 'style'
extraAllowedContent: 'style',
//filebrowserBrowseUrl : 'editor/pdw_browser/index.php?editor=ckeditor&uploadpath='+mediavariable,
//filebrowserImageBrowseUrl : 'editor/pdw_browser/index.php?editor=ckeditor&filter=image&uploadpath='+mediavariable,
//filebrowserFlashBrowseUrl : 'editor/pdw_browser/index.php?editor=ckeditor&filter=flash&uploadpath='+mediavariable
language : language.$code.substr(0,2)
};

if (options.options.height)
Expand Down Expand Up @@ -863,9 +864,18 @@ var EDITOR = (function ($, parent) {
this.on('focus', function () {
this.setReadOnly(false);
});
}, { toolbarGroups : [
}, { toolbar:
[
[ 'Font', 'FontSize', 'TextColor', 'BGColor' ],
[ 'Bold', 'Italic', 'Underline', 'Superscript', 'Subscript'],
[ 'Sourcedialog' ]
],
/*
toolbarGroups : [
{ name: 'document' },
{ name: 'basicstyles', groups: [ 'basicstyles' ] },
{ name: 'colors' }],
*/
filebrowserBrowseUrl : 'editor/elfinder/browse.php?mode=cke&type=media',
filebrowserImageBrowseUrl : 'editor/elfinder/browse.php?mode=cke&type=image',
filebrowserFlashBrowseUrl : 'editor/elfinder/browse.php?mode=cke&type=flash',
Expand All @@ -876,10 +886,12 @@ var EDITOR = (function ($, parent) {
//filebrowserImageUploadUrl : 'editor/kcfinder/upload.php?opener=ckeditor&type=media',
//filebrowserFlashUploadUrl : 'editor/kcfinder/upload.php?opener=ckeditor&type=media',
mathJaxClass : 'mathjax',
mathJaxLib : '//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_HTMLorMML-full'
mathJaxLib : '//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_HTMLorMML-full',
//filebrowserBrowseUrl : 'editor/pdw_browser/index.php?editor=ckeditor&uploadpath='+mediavariable,
//filebrowserImageBrowseUrl : 'editor/pdw_browser/index.php?editor=ckeditor&filter=image&uploadpath='+mediavariable,
//filebrowserFlashBrowseUrl : 'editor/pdw_browser/index.php?editor=ckeditor&filter=flash&uploadpath='+mediavariable
extraPlugins : 'sourcedialog',
language : language.$code.substr(0,2)
});
}
});
Expand Down
7 changes: 7 additions & 0 deletions editor/js/tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,13 @@ var EDITOR = (function ($, parent) {
// Refresh the page when a new node is selected
showNodeData = function (key) {


// Cleanup all current CKEDITOR instances!
for(name in CKEDITOR.instances)
{
CKEDITOR.instances[name].destroy(true);
}

var attributes = lo_data[key]['attributes'];

// Get the node name
Expand Down
11 changes: 9 additions & 2 deletions editor/js/vendor/ckeditor/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ CKEDITOR.editorConfig = function( config ) {
{ name: 'others' }
];

config.extraPlugins = 'dialog,widget,extmathjax,image2,codemirror,oembed,xotmarkword';

config.extraPlugins = 'dialog,widget,extmathjax,image2,codemirror,oembed,xotmarkword,fontawesome';
// The default plugins included in the basic setup define some buttons that
// we don't want too have in a basic editor. We remove them here.
//config.removeButtons = 'Cut,Copy,Paste,Undo,Redo,Anchor,Underline,Strike,Subscript,Superscript';
Expand All @@ -35,6 +36,12 @@ CKEDITOR.editorConfig = function( config ) {
config.toolbarCanCollapse = true;
config.allowedContent = true;
config.extraAllowedContent = 'p(*)[*]{*};div(*)[*]{*};li(*)[*]{*};ul(*)[*]{*}';

config.contentsCss = ['editor/js/vendor/ckeditor/contents.css',
'modules/xerte/parent_templates/Nottingham/common_html5/css/smoothness/jquery-ui-1.8.18.custom.css',
'modules/xerte/parent_templates/Nottingham/common_html5/css/themeStyles.css',
'modules/xerte/parent_templates/Nottingham/common_html5/css/mainStyles.css',
'modules/xerte/parent_templates/Nottingham/common_html5/font-awesome/css/font-awesome.min.css'
];
};
CKEDITOR.dtd.$removeEmpty.i = 0;
CKEDITOR.dtd.$removeEmpty.span = 0;
2 changes: 1 addition & 1 deletion editor/js/vendor/ckeditor/lang/en-gb.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions editor/js/vendor/ckeditor/plugins/fontawesome/plugin.js

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/**
* @license Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or http://ckeditor.com/license
*/

CKEDITOR.dialog.add( 'sourcedialog', function( editor ) {
var size = CKEDITOR.document.getWindow().getViewPaneSize();

// Make it maximum 800px wide, but still fully visible in the viewport.
var width = Math.min( size.width - 70, 800 );

// Make it use 2/3 of the viewport height.
var height = size.height / 1.5;

// Store old editor data to avoid unnecessary setData.
var oldData;

return {
title: editor.lang.sourcedialog.title,
minWidth: 100,
minHeight: 100,

onShow: function() {
this.setValueOf( 'main', 'data', oldData = editor.getData() );
},

onOk: ( function() {
function setData( dialog, newData ) {
// [IE8] Focus editor before setting selection to avoid setting data on
// locked selection, because in case of inline editor, it won't be
// unlocked before editable's HTML is altered. (#11585)
editor.focus();
editor.setData( newData, function() {
dialog.hide();

// Ensure correct selection.
var range = editor.createRange();
range.moveToElementEditStart( editor.editable() );
range.select();
} );
}

return function( event ) {
// Remove CR from input data for reliable comparison with editor data.
var newData = this.getValueOf( 'main', 'data' ).replace( /\r/g, '' ),
that = this;

// Avoid unnecessary setData. Also preserve selection
// when user changed his mind and goes back to wysiwyg editing.
if ( newData === oldData )
return true;

setTimeout( function() {
setData( that, newData );
} );

// Don't let the dialog close before setData is over, to hide
// from user blinking caused by selection restoring and setting new data.
return false;
};
} )(),

contents: [ {
id: 'main',
label: editor.lang.sourcedialog.title,
elements: [ {
type: 'textarea',
id: 'data',
dir: 'ltr',
inputStyle: 'cursor:auto;' +
'width:' + width + 'px;' +
'height:' + height + 'px;' +
'tab-size:4;' +
'text-align:left;',
'class': 'cke_source'
} ]
} ]
};
} );
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions editor/js/vendor/ckeditor/plugins/sourcedialog/lang/af.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/

CKEDITOR.plugins.setLang( 'sourcedialog', 'af', {
toolbar: '',
title: 'Bron'
} );
9 changes: 9 additions & 0 deletions editor/js/vendor/ckeditor/plugins/sourcedialog/lang/ar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/

CKEDITOR.plugins.setLang( 'sourcedialog', 'ar', {
toolbar: '',
title: 'المصدر'
} );
9 changes: 9 additions & 0 deletions editor/js/vendor/ckeditor/plugins/sourcedialog/lang/bg.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/

CKEDITOR.plugins.setLang( 'sourcedialog', 'bg', {
toolbar: '',
title: 'Източник'
} );
9 changes: 9 additions & 0 deletions editor/js/vendor/ckeditor/plugins/sourcedialog/lang/bn.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/

CKEDITOR.plugins.setLang( 'sourcedialog', 'bn', {
toolbar: '',
title: 'সোর্স'
} );
9 changes: 9 additions & 0 deletions editor/js/vendor/ckeditor/plugins/sourcedialog/lang/bs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/

CKEDITOR.plugins.setLang( 'sourcedialog', 'bs', {
toolbar: '',
title: 'HTML kôd'
} );
9 changes: 9 additions & 0 deletions editor/js/vendor/ckeditor/plugins/sourcedialog/lang/ca.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/

CKEDITOR.plugins.setLang( 'sourcedialog', 'ca', {
toolbar: '',
title: 'Codi font'
} );
9 changes: 9 additions & 0 deletions editor/js/vendor/ckeditor/plugins/sourcedialog/lang/cs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/

CKEDITOR.plugins.setLang( 'sourcedialog', 'cs', {
toolbar: '',
title: 'Zdroj'
} );
9 changes: 9 additions & 0 deletions editor/js/vendor/ckeditor/plugins/sourcedialog/lang/cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/

CKEDITOR.plugins.setLang( 'sourcedialog', 'cy', {
toolbar: '',
title: 'HTML'
} );
9 changes: 9 additions & 0 deletions editor/js/vendor/ckeditor/plugins/sourcedialog/lang/da.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/

CKEDITOR.plugins.setLang( 'sourcedialog', 'da', {
toolbar: '',
title: 'Kilde'
} );
9 changes: 9 additions & 0 deletions editor/js/vendor/ckeditor/plugins/sourcedialog/lang/de.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/

CKEDITOR.plugins.setLang( 'sourcedialog', 'de', {
toolbar: '',
title: 'Quellcode'
} );
9 changes: 9 additions & 0 deletions editor/js/vendor/ckeditor/plugins/sourcedialog/lang/el.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/

CKEDITOR.plugins.setLang( 'sourcedialog', 'el', {
toolbar: '',
title: 'Κώδικας'
} );
9 changes: 9 additions & 0 deletions editor/js/vendor/ckeditor/plugins/sourcedialog/lang/en-au.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/

CKEDITOR.plugins.setLang( 'sourcedialog', 'en-au', {
toolbar: '',
title: 'Source'
} );
9 changes: 9 additions & 0 deletions editor/js/vendor/ckeditor/plugins/sourcedialog/lang/en-ca.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/

CKEDITOR.plugins.setLang( 'sourcedialog', 'en-ca', {
toolbar: '',
title: 'Source'
} );
9 changes: 9 additions & 0 deletions editor/js/vendor/ckeditor/plugins/sourcedialog/lang/en-gb.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/

CKEDITOR.plugins.setLang( 'sourcedialog', 'en-gb', {
toolbar: '',
title: 'Source'
} );
9 changes: 9 additions & 0 deletions editor/js/vendor/ckeditor/plugins/sourcedialog/lang/en.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/

CKEDITOR.plugins.setLang( 'sourcedialog', 'en', {
toolbar: '',
title: 'Source'
} );
9 changes: 9 additions & 0 deletions editor/js/vendor/ckeditor/plugins/sourcedialog/lang/eo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/

CKEDITOR.plugins.setLang( 'sourcedialog', 'eo', {
toolbar: '',
title: 'Fonto'
} );
9 changes: 9 additions & 0 deletions editor/js/vendor/ckeditor/plugins/sourcedialog/lang/es.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/

CKEDITOR.plugins.setLang( 'sourcedialog', 'es', {
toolbar: '',
title: 'Fuente HTML'
} );
9 changes: 9 additions & 0 deletions editor/js/vendor/ckeditor/plugins/sourcedialog/lang/et.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/

CKEDITOR.plugins.setLang( 'sourcedialog', 'et', {
toolbar: '',
title: 'Lähtekood'
} );
9 changes: 9 additions & 0 deletions editor/js/vendor/ckeditor/plugins/sourcedialog/lang/eu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/

CKEDITOR.plugins.setLang( 'sourcedialog', 'eu', {
toolbar: '',
title: 'HTML Iturburua'
} );
9 changes: 9 additions & 0 deletions editor/js/vendor/ckeditor/plugins/sourcedialog/lang/fa.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/

CKEDITOR.plugins.setLang( 'sourcedialog', 'fa', {
toolbar: '',
title: 'منبع'
} );
9 changes: 9 additions & 0 deletions editor/js/vendor/ckeditor/plugins/sourcedialog/lang/fi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/

CKEDITOR.plugins.setLang( 'sourcedialog', 'fi', {
toolbar: '',
title: 'Koodi'
} );
9 changes: 9 additions & 0 deletions editor/js/vendor/ckeditor/plugins/sourcedialog/lang/fo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/

CKEDITOR.plugins.setLang( 'sourcedialog', 'fo', {
toolbar: '',
title: 'Kelda'
} );
Loading

0 comments on commit 33a11dc

Please sign in to comment.