Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tweaks: issues and build sh #15

Merged
merged 3 commits into from
Aug 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dev/builder/build-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ var CKBUILDER_CONFIG = {
fontfamily: 1,
fontsize: 1,
// font: 1,
// format: 1,
format: 1,
// forms: 1,
// horizontalrule: 1,
// htmlwriter: 1,
Expand Down
4 changes: 2 additions & 2 deletions dev/builder/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ echo "CKBuilder - Builds a release version of ckeditor-dev."
echo ""

CKBUILDER_VERSION="2.1.0"
CKBUILDER_URL="http://download.cksource.com/CKBuilder/$CKBUILDER_VERSION/ckbuilder.jar"
CKBUILDER_URL="https://download.cksource.com/CKBuilder/$CKBUILDER_VERSION/ckbuilder.jar"

PROGNAME=$(basename $0)
MSG_UPDATE_FAILED="Warning: The attempt to update ckbuilder.jar failed. The existing file will be used."
Expand Down Expand Up @@ -71,7 +71,7 @@ then
VERSION=$TAG
fi

java -jar ckbuilder/$CKBUILDER_VERSION/ckbuilder.jar --build ../../ ~/strikingly/ckeditor/vendor/assets/javascripts $JAVA_ARGS --version="$VERSION" --revision="$REVISION" --overwrite --no-zip --no-tar --skip-omitted-in-build-config --leave-js-unminified
java -jar ckbuilder/$CKBUILDER_VERSION/ckbuilder.jar --build ../../ ~/strikingly/ckeditor/vendor/assets/javascripts $JAVA_ARGS --version="$VERSION" --revision="$REVISION" --overwrite --no-zip --no-tar --skip-omitted-in-build-config
java -jar ckbuilder/$CKBUILDER_VERSION/ckbuilder.jar --build-skin ../../skins/clean ~/strikingly/ckeditor/vendor/assets/javascripts/ckeditor/skins/clean --overwrite

# Copy and build tests
Expand Down
71 changes: 69 additions & 2 deletions plugins/colorbutton/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@ CKEDITOR.plugins.add( 'colorbutton', {
var iconStyles = config.colorButton_iconStyles(computedColor)
span.setStyles(iconStyles)
span.setAttribute('title', (editor.lang.colorbutton.textColorTitle || ''))
})
if (editor.config.customColorPlate) {
editor.config.customColorPlate.init(btn._.id, chooseColor, computedColor)
return
}

})
editor.ui.add( name, CKEDITOR.UI_PANELBUTTON, {
modes: { wysiwyg: 1 },
editorFocus: 0,
Expand All @@ -96,6 +101,12 @@ CKEDITOR.plugins.add( 'colorbutton', {
// The block should not have scrollbars (#5933, #6056)
block.element.getDocument().getBody().setStyle( 'overflow', 'hidden' );

if (editor.config.customColorPlate) {
panel.element.setStyle('overflow', 'inherit');
panel.element.appendHtml('<div id="' + this._.id + '_color_plate" style="position: absolute; top: 0; background: rgb(51, 51, 51); border-radius: 4px; padding: 2px;"/>');
editor.config.customColorPlate.init(this._.id, chooseColor, '#fff')
}

CKEDITOR.ui.fire( 'ready', this );

var keys = block.keys;
Expand All @@ -112,6 +123,10 @@ CKEDITOR.plugins.add( 'colorbutton', {
onOpen: function() {
var doc = this._.panel._.iframe.getFrameDocument()

if (editor.config.customColorPlate) {
return
}

if (editor.config.advancedEditor) {
// on advanced-text-editor
var activeItem = doc.find('.cke_coloricon_active').getItem(0)
Expand Down Expand Up @@ -157,6 +172,58 @@ CKEDITOR.plugins.add( 'colorbutton', {
} );
}

function chooseColor(colorName) {
var clickFn = CKEDITOR.tools.addFunction( function( color ) {
if (config.colorButton_clickCustomColorCallback) {
config.colorButton_clickCustomColorCallback(color)
}

var selection = editor.getSelection();
if (!selection) {
return;
}
editor.focus();
editor.fire( 'saveSnapshot' );

if (editor.config.advancedEditor) {
var range = editor.createRange();
var selection = editor.getSelection()

var colorStyle = config[ 'colorButton_foreStyle' ];
if (color === 'default' || !color) {
// select all contents
editor.document.$.execCommand( 'SelectAll', false, null );

classNames.map(function(className) {
editor.removeStyle( new CKEDITOR.style( colorStyle, {className: className}))
});

editor.removeStyle( new CKEDITOR.style( colorStyle, {className: '#(className)'} ))
editor.applyStyle( new CKEDITOR.style(Object.assign({}, colorStyle, { styles: { color: 'unset' } })) );

selection.removeAllRanges()
} else {

classNames.map(function(className) {
editor.removeStyle( new CKEDITOR.style( colorStyle, {className: className}))
});

if ( color ) {
colorStyle.childRule = function( element ) {
// Fore color style must be applied inside links instead of around it. (#4772,#6908)
return !( element.is( 'a' ) || element.getElementsByTag( 'a' ).count() ) && !(element.is("font") || element.getElementsByTag("font").count()) || isUnstylable( element );
};
editor.applyStyle( new CKEDITOR.style(Object.assign({}, colorStyle, { styles: { color: colorName } })) );
}
}
}

editor.focus();
editor.fire( 'saveSnapshot' );
} );
CKEDITOR.tools.callFunction(clickFn, colorName)
}

function renderColors( panel, type, colorBoxId ) {
var output = [],
classNamePattern = config.colorButton_colorClassNamePattern,
Expand Down Expand Up @@ -221,7 +288,7 @@ CKEDITOR.plugins.add( 'colorbutton', {
if ( color ) {
// get classname
var colorClassName = config.colorButton_colorClassNamePattern.replace('%s', color);

colorStyle.childRule = function( element ) {
// Fore color style must be applied inside links instead of around it. (#4772,#6908)
return !( element.is( 'a' ) || element.getElementsByTag( 'a' ).count() ) || isUnstylable( element );
Expand Down
33 changes: 18 additions & 15 deletions plugins/format/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ CKEDITOR.plugins.add( 'format', {
var tags = config.format_tags.split( ';' );

// Create style objects for all defined styles.

var styles = {},
stylesCount = 0,
allowedContent = [];
Expand All @@ -38,25 +39,24 @@ CKEDITOR.plugins.add( 'format', {
return;

editor.ui.addRichCombo( 'Format', {
label: lang.label,
title: lang.panelTitle,
label: '',
toolbar: 'styles,20',

allowedContent: allowedContent,

panel: {
css: [ CKEDITOR.skin.getPath( 'editor' ) ].concat( config.contentsCss ),
multiSelect: false,
attributes: { 'aria-label': lang.panelTitle }
},

init: function() {
this.startGroup( lang.panelTitle );
// this.startGroup( editor.lang.format.label );

for ( var tag in styles ) {
var label = lang[ 'tag_' + tag ];
var label = editor.lang.format[tag];

// Add the tag entry to the panel list.
this.add( tag, styles[ tag ].buildPreview( label ), label );
this.add( tag, label, 'content-' + tag );
}
},

Expand Down Expand Up @@ -85,7 +85,7 @@ CKEDITOR.plugins.add( 'format', {
for ( var tag in styles ) {
if ( styles[ tag ].checkActive( elementPath, editor ) ) {
if ( tag != currentTag )
this.setValue( tag, editor.lang.format[ 'tag_' + tag ] );
this.setValue( tag, editor.lang.format[tag] );
return;
}
}
Expand Down Expand Up @@ -143,7 +143,7 @@ CKEDITOR.plugins.add( 'format', {
* @cfg {String} [format_tags='p;h1;h2;h3;h4;h5;h6;pre;address;div']
* @member CKEDITOR.config
*/
CKEDITOR.config.format_tags = 'p;h1;h2;h3;h4;h5;h6;pre;address;div';
CKEDITOR.config.format_tags = 'h1;h2;h3;h4;h5;p;div';

/**
* The style definition to be used to apply the `Normal` format.
Expand All @@ -152,8 +152,11 @@ CKEDITOR.config.format_tags = 'p;h1;h2;h3;h4;h5;h6;pre;address;div';
*
* @cfg {Object} [format_p={ element: 'p' }]
* @member CKEDITOR.config
*
*
*/
CKEDITOR.config.format_p = { element: 'p' };

CKEDITOR.config.format_p = { element: 'p', attributes: { 'class': 'normalPara' } };

/**
* The style definition to be used to apply the `Normal (DIV)` format.
Expand All @@ -163,7 +166,7 @@ CKEDITOR.config.format_p = { element: 'p' };
* @cfg {Object} [format_div={ element: 'div' }]
* @member CKEDITOR.config
*/
CKEDITOR.config.format_div = { element: 'div' };
CKEDITOR.config.format_div = { element: 'div', attributes: { 'class': 'normalDiv' } };

/**
* The style definition to be used to apply the `Formatted` format.
Expand Down Expand Up @@ -193,7 +196,7 @@ CKEDITOR.config.format_address = { element: 'address' };
* @cfg {Object} [format_h1={ element: 'h1' }]
* @member CKEDITOR.config
*/
CKEDITOR.config.format_h1 = { element: 'h1' };
CKEDITOR.config.format_h1 = { element: 'h1', attributes: { 'class': 'h1Tag' } };

/**
* The style definition to be used to apply the `Heading 2` format.
Expand All @@ -203,7 +206,7 @@ CKEDITOR.config.format_h1 = { element: 'h1' };
* @cfg {Object} [format_h2={ element: 'h2' }]
* @member CKEDITOR.config
*/
CKEDITOR.config.format_h2 = { element: 'h2' };
CKEDITOR.config.format_h2 = { element: 'h2', attributes: { 'class': 'h2Tag' } };

/**
* The style definition to be used to apply the `Heading 3` format.
Expand All @@ -213,7 +216,7 @@ CKEDITOR.config.format_h2 = { element: 'h2' };
* @cfg {Object} [format_h3={ element: 'h3' }]
* @member CKEDITOR.config
*/
CKEDITOR.config.format_h3 = { element: 'h3' };
CKEDITOR.config.format_h3 = { element: 'h3', attributes: { 'class': 'h3Tag' } };

/**
* The style definition to be used to apply the `Heading 4` format.
Expand All @@ -223,7 +226,7 @@ CKEDITOR.config.format_h3 = { element: 'h3' };
* @cfg {Object} [format_h4={ element: 'h4' }]
* @member CKEDITOR.config
*/
CKEDITOR.config.format_h4 = { element: 'h4' };
CKEDITOR.config.format_h4 = { element: 'h4', attributes: { 'class': 'h4Tag' } };

/**
* The style definition to be used to apply the `Heading 5` format.
Expand All @@ -233,7 +236,7 @@ CKEDITOR.config.format_h4 = { element: 'h4' };
* @cfg {Object} [format_h5={ element: 'h5' }]
* @member CKEDITOR.config
*/
CKEDITOR.config.format_h5 = { element: 'h5' };
CKEDITOR.config.format_h5 = { element: 'h5', attributes: { 'class': 'h5Tag' } };

/**
* The style definition to be used to apply the `Heading 6` format.
Expand Down
53 changes: 52 additions & 1 deletion skins/clean/editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,55 @@ legend.cke_voice_label
*/
a.cke_menubutton__fontsizeSmaller {
border-top: 1px solid #777;
}
}


.cke_combo__format {
height: 26px;
cursor: pointer;
}

.cke_combo__format a.cke_combo_button {
margin: 0 0;
background: transparent;
border-radius: 0;
border: none;
box-shadow: none;
}

.cke_combo__format.cke_combo_on a.cke_combo_button:hover {
box-shadow: none;
}

.cke_combo__format.cke_combo_on {
background: #555;
}

.cke_combo__format a.cke_combo_button:hover, .cke_combo__format a.cke_combo_button:focus {
background: #777;
box-shadow: none;
}

.cke_combo__format.cke_combo_off {
background: transparent;
}

.cke_combo__format .cke_combo_inlinelabel, .cke_combo__format .cke_combo_text {
margin-top: 4px;
width: 5px;
height: 16px;
display: inline-block;
text-shadow: none;
text-indent: -9999px;
background: url("icons_hidpi.png") no-repeat 0 -576px!important;
background-size: 16px!important;
cursor: pointer;
}

.cke_combo__format .cke_combo_button .cke_combo_open {
margin: 1px 7px 2px 1px;
}

.cke_combo__format .cke_combo_button .cke_combo_arrow {
border-top: 3px solid #eee;
}
Loading