Skip to content

Commit

Permalink
New version 3.4.29. Read more https://github.com/xdan/jodit/blob/mast…
Browse files Browse the repository at this point in the history
  • Loading branch information
xdan committed Oct 15, 2020
1 parent b151660 commit d2de5af
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 23 deletions.
2 changes: 1 addition & 1 deletion build/jodit.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* jodit - Jodit is awesome and usefully wysiwyg editor with filebrowser
* Author: Chupurnov <[email protected]> (https://xdsoft.net/)
* Version: v3.4.28
* Version: v3.4.29
* Url: https://xdsoft.net/jodit/
* License(s): MIT
*/
Expand Down
2 changes: 1 addition & 1 deletion build/jodit.es2018.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* jodit - Jodit is awesome and usefully wysiwyg editor with filebrowser
* Author: Chupurnov <[email protected]> (https://xdsoft.net/)
* Version: v3.4.28
* Version: v3.4.29
* Url: https://xdsoft.net/jodit/
* License(s): MIT
*/
Expand Down
27 changes: 21 additions & 6 deletions build/jodit.es2018.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* jodit - Jodit is awesome and usefully wysiwyg editor with filebrowser
* Author: Chupurnov <[email protected]> (https://xdsoft.net/)
* Version: v3.4.28
* Version: v3.4.29
* Url: https://xdsoft.net/jodit/
* License(s): MIT
*/
Expand Down Expand Up @@ -1904,6 +1904,7 @@ class Config {
this.disablePlugins = [];
this.extraPlugins = [];
this.extraButtons = [];
this.extraIcons = {};
this.createAttributes = {};
this.sizeLG = 900;
this.sizeMD = 700;
Expand Down Expand Up @@ -6483,6 +6484,7 @@ class Icon {
this.icons[name.replace('_', '-')] = value;
}
static makeIcon(jodit, icon) {
var _a;
let iconElement;
if (icon) {
const clearName = icon.name.replace(/[^a-zA-Z0-9]/g, '_');
Expand All @@ -6494,10 +6496,12 @@ class Icon {
}
else {
const svg = jodit.e.fire('getIcon', icon.name, icon, clearName) ||
Icon.get(icon.name, '');
Icon.get(icon.name, '') || ((_a = jodit.o.extraIcons) === null || _a === void 0 ? void 0 : _a[icon.name]);
if (svg) {
iconElement = jodit.c.fromHTML(svg.trim());
iconElement.classList.add('jodit-icon_' + clearName);
if (!/^<svg/i.test(icon.name)) {
iconElement.classList.add('jodit-icon_' + clearName);
}
}
}
}
Expand Down Expand Up @@ -12287,7 +12291,7 @@ class view_View extends core_component["a" /* Component */] {
this.isJodit = isJodit;
this.isView = true;
this.components = new Set();
this.version = "3.4.28";
this.version = "3.4.29";
this.async = new async_Async();
this.buffer = storage_Storage.makeStorage();
this.OPTIONS = view_View.defaultOptions;
Expand Down Expand Up @@ -12739,6 +12743,7 @@ class button_ToolbarButton extends ui_button["b" /* UIButton */] {
}
}
initFromControl() {
var _a;
const { control, state } = this;
this.updateSize();
state.name = control.name;
Expand All @@ -12755,7 +12760,7 @@ class button_ToolbarButton extends ui_button["b" /* UIButton */] {
}
else {
const name = control.icon || control.name;
state.icon.name = ui["b" /* Icon */].exists(name) ? name : '';
state.icon.name = (ui["b" /* Icon */].exists(name) || ((_a = this.j.o.extraIcons) === null || _a === void 0 ? void 0 : _a[name])) ? name : '';
}
if (!control.iconURL && !state.icon.name) {
state.text = control.text || control.name;
Expand Down Expand Up @@ -15905,13 +15910,22 @@ class snapshot_Snapshot extends core_component["c" /* ViewComponent */] {
}
restore(snapshot) {
this.isBlocked = true;
const scroll = this.storeScrollState();
const value = this.j.getNativeEditorValue();
if (value !== snapshot.html) {
this.j.setEditorValue(snapshot.html);
}
this.restoreOnlySelection(snapshot);
this.restoreScrollState(scroll);
this.isBlocked = false;
}
storeScrollState() {
return [window.scrollY, this.j.editor.scrollTop];
}
restoreScrollState(scrolls) {
window.scrollTo(window.scrollX, scrolls[0]);
this.j.editor.scrollTop = scrolls[1];
}
restoreOnlySelection(snapshot) {
try {
if (snapshot.range) {
Expand Down Expand Up @@ -18771,7 +18785,8 @@ class jodit_Jodit extends view_with_toolbar_ViewWithToolbar {
}
const active = this.od.activeElement;
if (active &&
(dom["a" /* Dom */].isOrContains(this.editor, active) ||
(active === this.iframe ||
dom["a" /* Dom */].isOrContains(this.editor, active) ||
dom["a" /* Dom */].isOrContains(this.toolbar.container, active))) {
return constants["MODE_WYSIWYG"];
}
Expand Down
2 changes: 1 addition & 1 deletion build/jodit.es2018.min.css

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

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

Large diffs are not rendered by default.

29 changes: 22 additions & 7 deletions build/jodit.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* jodit - Jodit is awesome and usefully wysiwyg editor with filebrowser
* Author: Chupurnov <[email protected]> (https://xdsoft.net/)
* Version: v3.4.28
* Version: v3.4.29
* Url: https://xdsoft.net/jodit/
* License(s): MIT
*/
Expand Down Expand Up @@ -1126,6 +1126,7 @@ var Config = (function () {
this.disablePlugins = [];
this.extraPlugins = [];
this.extraButtons = [];
this.extraIcons = {};
this.createAttributes = {};
this.sizeLG = 900;
this.sizeMD = 700;
Expand Down Expand Up @@ -4481,6 +4482,7 @@ var Icon = (function () {
this.icons[name.replace('_', '-')] = value;
};
Icon.makeIcon = function (jodit, icon) {
var _a;
var iconElement;
if (icon) {
var clearName = icon.name.replace(/[^a-zA-Z0-9]/g, '_');
Expand All @@ -4492,10 +4494,12 @@ var Icon = (function () {
}
else {
var svg = jodit.e.fire('getIcon', icon.name, icon, clearName) ||
Icon.get(icon.name, '');
Icon.get(icon.name, '') || ((_a = jodit.o.extraIcons) === null || _a === void 0 ? void 0 : _a[icon.name]);
if (svg) {
iconElement = jodit.c.fromHTML(svg.trim());
iconElement.classList.add('jodit-icon_' + clearName);
if (!/^<svg/i.test(icon.name)) {
iconElement.classList.add('jodit-icon_' + clearName);
}
}
}
}
Expand Down Expand Up @@ -4856,7 +4860,7 @@ var View = (function (_super) {
_this.isJodit = isJodit;
_this.isView = true;
_this.components = new Set();
_this.version = "3.4.28";
_this.version = "3.4.29";
_this.async = new async_1.Async();
_this.buffer = storage_1.Storage.makeStorage();
_this.OPTIONS = View.defaultOptions;
Expand Down Expand Up @@ -5394,7 +5398,8 @@ var ToolbarButton = (function (_super) {
}
};
ToolbarButton.prototype.initFromControl = function () {
var _a = this, control = _a.control, state = _a.state;
var _a;
var _b = this, control = _b.control, state = _b.state;
this.updateSize();
state.name = control.name;
var textIcons = this.j.o.textIcons;
Expand All @@ -5410,7 +5415,7 @@ var ToolbarButton = (function (_super) {
}
else {
var name_1 = control.icon || control.name;
state.icon.name = __1.Icon.exists(name_1) ? name_1 : '';
state.icon.name = (__1.Icon.exists(name_1) || ((_a = this.j.o.extraIcons) === null || _a === void 0 ? void 0 : _a[name_1])) ? name_1 : '';
}
if (!control.iconURL && !state.icon.name) {
state.text = control.text || control.name;
Expand Down Expand Up @@ -5822,13 +5827,22 @@ var Snapshot = (function (_super) {
};
Snapshot.prototype.restore = function (snapshot) {
this.isBlocked = true;
var scroll = this.storeScrollState();
var value = this.j.getNativeEditorValue();
if (value !== snapshot.html) {
this.j.setEditorValue(snapshot.html);
}
this.restoreOnlySelection(snapshot);
this.restoreScrollState(scroll);
this.isBlocked = false;
};
Snapshot.prototype.storeScrollState = function () {
return [window.scrollY, this.j.editor.scrollTop];
};
Snapshot.prototype.restoreScrollState = function (scrolls) {
window.scrollTo(window.scrollX, scrolls[0]);
this.j.editor.scrollTop = scrolls[1];
};
Snapshot.prototype.restoreOnlySelection = function (snapshot) {
try {
if (snapshot.range) {
Expand Down Expand Up @@ -8381,7 +8395,8 @@ var Jodit = (function (_super) {
}
var active = this.od.activeElement;
if (active &&
(modules_1.Dom.isOrContains(this.editor, active) ||
(active === this.iframe ||
modules_1.Dom.isOrContains(this.editor, active) ||
modules_1.Dom.isOrContains(this.toolbar.container, active))) {
return consts.MODE_WYSIWYG;
}
Expand Down
2 changes: 1 addition & 1 deletion 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 package-lock.json

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

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.4.28",
"version": "3.4.29",
"description": "Jodit is awesome and usefully wysiwyg editor with filebrowser",
"main": "build/jodit.min.js",
"types": "index.d.ts",
Expand Down

0 comments on commit d2de5af

Please sign in to comment.