Skip to content

Commit

Permalink
New version 3.0.15. Read more https://github.com/xdan/jodit/releases/…
Browse files Browse the repository at this point in the history
  • Loading branch information
xdan committed Aug 21, 2017
1 parent d40d697 commit bf80552
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 13 deletions.
4 changes: 2 additions & 2 deletions build/jodit.min.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions build/jodit.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
}
editor = new Jodit('#area_editor', {
// theme: 'dark',
toolbarButtonSize: 'large',
// textIcons: true,
// iframe: true,
// height: 100,
observer: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jodit",
"version": "3.0.14",
"version": "3.0.15",
"description": "Jodit is awesome and usefully wysiwyg editor with filebrowser",
"main": "index.js",
"scripts": {
Expand Down
7 changes: 6 additions & 1 deletion src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,12 @@ export class Config {
controls: {[key: string]: ControlType};

events: {[key: string]: Function} = {};
textIcons: boolean = true;

/**
* Buttons in toolbat without SVG - only texts
* @type {boolean}
*/
textIcons: boolean = false;
};
Config.prototype.controls = {
about: {
Expand Down
7 changes: 6 additions & 1 deletion src/Jodit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface JoditPlugin{

/** Class Jodit. Main class*/
export default class Jodit extends Component{
version: string = appVersion;
version: string = appVersion; // from webpack.config.js


static defaultOptions: Config;
Expand Down Expand Up @@ -173,6 +173,10 @@ export default class Jodit extends Component{

this.container.classList.add('jodit_toolbar_size-' + (['middle', 'large', 'small'].indexOf(this.options.toolbarButtonSize.toLowerCase()) !== -1 ? this.options.toolbarButtonSize.toLowerCase() : 'middle'));

if (this.options.textIcons) {
this.container.classList.add('jodit_text_icons');
}

this.__on(window, 'resize', () => {
this.events.fire('resize');
});
Expand Down Expand Up @@ -228,6 +232,7 @@ export default class Jodit extends Component{


private __defaultStyleDisplayKey = 'data-jodit-default-style-display';

/**
* Create main DIV element and replace source textarea
*
Expand Down
21 changes: 16 additions & 5 deletions src/modules/Toolbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default class Toolbar extends Component{
* @param {string|boolean} [defaultValue='<span></span>']
* @return {string}
*/
static getIcon(name, defaultValue:string|false = '<span></span>') {
static getIcon(name: string, defaultValue:string|false = '<span></span>') {
return Toolbar.icons[name] !== undefined ? Toolbar.icons[name] : defaultValue;
}

Expand Down Expand Up @@ -224,12 +224,19 @@ export default class Toolbar extends Component{
name: string = typeof item === 'string' ? item : (item.name || 'empty'),
a: HTMLAnchorElement = btn.querySelector('a');

let iconSVG: string|false = Toolbar.getIcon(name, false);
let iconSVG: string|false;

if (iconSVG === false) {
iconSVG = Toolbar.getIcon(typeof control.name === 'string' ? control.name : 'empty');
if (!this.jodit.options.textIcons) {
iconSVG = Toolbar.getIcon(name, false);

if (iconSVG === false) {
iconSVG = Toolbar.getIcon(typeof control.name === 'string' ? control.name : 'empty');
}
} else {
iconSVG = `<span>${name}</span>`;
}


//btn.control = control;

const clearName = name.replace(/[^a-zA-Z0-9]/g, '_');
Expand All @@ -243,7 +250,11 @@ export default class Toolbar extends Component{
});

let icon = dom(<string>iconSVG);
icon.classList.add('jodit_icon', 'jodit_icon_' + clearName);

if (icon && icon.nodeType !== Node.TEXT_NODE) {
icon.classList.add('jodit_icon', 'jodit_icon_' + clearName);
}

a.appendChild(icon);

if (control === undefined || typeof(control) !== 'object') {
Expand Down
42 changes: 42 additions & 0 deletions src/styles/plugins/texticons.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
@jodit_text_icons-font: Arial, "Helvetica Neue", Helvetica, Tahoma, sans-serif;
@jodit_text_icons-color: rgba(0, 0, 0, 0.75);
@jodit_text_icons-padding: 0 12px;

.jodit_text_icons {
.jodit_icon {
width: auto;
font-size:13px;
&::first-letter {
text-transform: uppercase;
}
}
.jodit_tabs .jodit_tabs_buttons > a {
width: auto;
font-family: @jodit_text_icons-font;
width: auto;
i {
width: auto;
}
}
.jodit_toolbar > li{
width: auto;
> a {
padding: @jodit_text_icons-padding;
font-family: @jodit_text_icons-font;
width: auto;
text-decoration: none;
color: @jodit_text_icons-color;
}
}
&.jodit_dialog_box .jodit_dialog {
.jodit_dialog_header a, .jodit_button {
width: auto;
padding: @jodit_text_icons-padding;
font-family: @jodit_text_icons-font;
color: @jodit_text_icons-color;
.jodit_icon {
width: auto;
}
}
}
}

0 comments on commit bf80552

Please sign in to comment.