Skip to content

Commit d6d304b

Browse files
author
Piotr Jasiun
committed
Merge branch 't/11079' into major
2 parents de8e4f2 + c03dd27 commit d6d304b

File tree

4 files changed

+30
-7
lines changed

4 files changed

+30
-7
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ New Features:
2121
* fix minor bugs,
2222
* [#10028](http://dev.ckeditor.com/ticket/10028): New [`config.dialog_noConfirmCancel`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-dialog_noConfirmCancel) configuration option that eliminates the need to confirm closing of a dialog window when the user changed any of its fields.
2323
* [#10848](http://dev.ckeditor.com/ticket/10848): Integrate remaining plugins (style, format, font, color, language and indent ) with active filter.
24+
* [#11079](http://dev.ckeditor.com/ticket/11079): Add button icons to Placeholder sample.
2425

2526
Fixed Issues:
2627

plugins/placeholder/plugin.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
// Put ur init code here.
3434
editor.widgets.add( 'placeholder', {
3535
// Widget code.
36-
button: lang.toolbar,
3736
dialog: 'placeholder',
3837
pathName: lang.pathName,
3938
// We need to have wrapping element, otherwise there are issues in
@@ -53,6 +52,13 @@
5352
this.element.setText( '[[' + this.data.name + ']]' );
5453
}
5554
} );
55+
56+
editor.ui.addButton && editor.ui.addButton( 'CreatePlaceholder', {
57+
label: lang.toolbar,
58+
command: 'placeholder',
59+
toolbar: 'insert,5',
60+
icon: 'placeholder'
61+
});
5662
},
5763

5864
afterInit: function( editor ) {

plugins/placeholder/samples/placeholder.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<title>Placeholder Plugin &mdash; CKEditor Sample</title>
99
<meta charset="utf-8">
1010
<script src="../../../ckeditor.js"></script>
11+
<script src="../../../samples/sample.js"></script>
1112
<link rel="stylesheet" href="../../../samples/sample.css">
1213
<meta name="ckeditor-sample-name" content="Placeholder plugin">
1314
<meta name="ckeditor-sample-group" content="Plugins">
@@ -22,11 +23,11 @@ <h1 class="samples">
2223
This sample shows how to configure CKEditor instances to use the
2324
<strong>Placeholder</strong> plugin that lets you insert read-only elements
2425
into your content. To enter and modify read-only text, use the
25-
<strong>Create Placeholder</strong> button and its matching dialog window.
26+
<strong>Create Placeholder</strong> <span class="button_icon" data-icon="placeholder">&nbsp;</span> button and its matching dialog window.
2627
</p>
2728
<p>
2829
To add a CKEditor instance that uses the <code>placeholder</code> plugin and a related
29-
<strong>Create Placeholder</strong> toolbar button, insert the following JavaScript
30+
<strong>Create Placeholder</strong> <span class="button_icon" data-icon="placeholder">&nbsp;</span> toolbar button, insert the following JavaScript
3031
call to your code:
3132
</p>
3233
<pre class="samples">
@@ -48,8 +49,7 @@ <h1 class="samples">
4849
<script>
4950

5051
CKEDITOR.replace( 'editor1', {
51-
extraPlugins: 'placeholder',
52-
toolbar: [ [ 'Source', 'Bold' ], [ 'Placeholder' ] ]
52+
extraPlugins: 'placeholder'
5353
});
5454

5555
</script>

samples/sample.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
// This file can be ignored and is not required to make use of CKEditor.
88

99
(function() {
10-
// Check for sample compliance.
1110
CKEDITOR.on( 'instanceReady', function( ev ) {
11+
// Check for sample compliance.
1212
var editor = ev.editor,
1313
meta = CKEDITOR.document.$.getElementsByName( 'ckeditor-sample-required-plugins' ),
1414
requires = meta.length ? CKEDITOR.dom.element.get( meta[ 0 ] ).getAttribute( 'content' ).split( ',' ) : [],
@@ -29,6 +29,22 @@
2929
warn.insertBefore( editor.container );
3030
}
3131
}
32-
});
32+
33+
// Set icons.
34+
var doc = new CKEDITOR.dom.document( document ),
35+
icons = doc.find( '.button_icon' );
36+
37+
for ( var i = 0, count = icons.count(); i < count; i++ ) {
38+
var icon = icons.getItem( i ),
39+
name = icon.getAttribute( 'data-icon' ),
40+
style = CKEDITOR.skin.getIconStyle( name, ( CKEDITOR.lang.dir == 'rtl' ) );
41+
42+
icon.addClass( 'cke_button_icon' );
43+
icon.addClass( 'cke_button__' + name + '_icon' );
44+
icon.setAttribute( 'style', style );
45+
icon.setStyle( 'float', 'none' );
46+
47+
};
48+
} );
3349
})();
3450
// %LEAVE_UNMINIFIED% %REMOVE_LINE%

0 commit comments

Comments
 (0)