Edit File by line
/home/barbar84/www/wp-conte.../plugins/file-man.../applicat.../library/js/extras
File: editors.default.js
(function(editors, elFinder) {
[0] Fix | Delete
if (typeof define === 'function' && define.amd) {
[1] Fix | Delete
define(['elfinder'], editors);
[2] Fix | Delete
} else if (elFinder) {
[3] Fix | Delete
var optEditors = elFinder.prototype._options.commandsOptions.edit.editors;
[4] Fix | Delete
elFinder.prototype._options.commandsOptions.edit.editors = optEditors.concat(editors(elFinder));
[5] Fix | Delete
}
[6] Fix | Delete
}(function(elFinder) {
[7] Fix | Delete
"use strict";
[8] Fix | Delete
var apps = {},
[9] Fix | Delete
// get query of getfile
[10] Fix | Delete
getfile = window.location.search.match(/getfile=([a-z]+)/),
[11] Fix | Delete
useRequire = elFinder.prototype.hasRequire,
[12] Fix | Delete
ext2mime = {
[13] Fix | Delete
bmp: 'image/x-ms-bmp',
[14] Fix | Delete
dng: 'image/x-adobe-dng',
[15] Fix | Delete
gif: 'image/gif',
[16] Fix | Delete
jpeg: 'image/jpeg',
[17] Fix | Delete
jpg: 'image/jpeg',
[18] Fix | Delete
pdf: 'application/pdf',
[19] Fix | Delete
png: 'image/png',
[20] Fix | Delete
ppm: 'image/x-portable-pixmap',
[21] Fix | Delete
psd: 'image/vnd.adobe.photoshop',
[22] Fix | Delete
pxd: 'image/x-pixlr-data',
[23] Fix | Delete
svg: 'image/svg+xml',
[24] Fix | Delete
tiff: 'image/tiff',
[25] Fix | Delete
webp: 'image/webp',
[26] Fix | Delete
xcf: 'image/x-xcf',
[27] Fix | Delete
sketch: 'application/x-sketch',
[28] Fix | Delete
ico: 'image/x-icon',
[29] Fix | Delete
dds: 'image/vnd-ms.dds',
[30] Fix | Delete
emf: 'application/x-msmetafile'
[31] Fix | Delete
},
[32] Fix | Delete
mime2ext,
[33] Fix | Delete
getExtention = function(mime, fm, jpeg) {
[34] Fix | Delete
if (!mime2ext) {
[35] Fix | Delete
mime2ext = fm.arrayFlip(ext2mime);
[36] Fix | Delete
}
[37] Fix | Delete
var ext = mime2ext[mime] || fm.mimeTypes[mime];
[38] Fix | Delete
if (!jpeg) {
[39] Fix | Delete
if (ext === 'jpeg') {
[40] Fix | Delete
ext = 'jpg';
[41] Fix | Delete
}
[42] Fix | Delete
} else {
[43] Fix | Delete
if (ext === 'jpg') {
[44] Fix | Delete
ext = 'jpeg';
[45] Fix | Delete
}
[46] Fix | Delete
}
[47] Fix | Delete
return ext;
[48] Fix | Delete
},
[49] Fix | Delete
changeImageType = function(src, toMime) {
[50] Fix | Delete
var dfd = $.Deferred();
[51] Fix | Delete
try {
[52] Fix | Delete
var canvas = document.createElement('canvas'),
[53] Fix | Delete
ctx = canvas.getContext('2d'),
[54] Fix | Delete
img = new Image(),
[55] Fix | Delete
conv = function() {
[56] Fix | Delete
var url = canvas.toDataURL(toMime),
[57] Fix | Delete
mime, m;
[58] Fix | Delete
if (m = url.match(/^data:([a-z0-9]+\/[a-z0-9.+-]+)/i)) {
[59] Fix | Delete
mime = m[1];
[60] Fix | Delete
} else {
[61] Fix | Delete
mime = '';
[62] Fix | Delete
}
[63] Fix | Delete
if (mime.toLowerCase() === toMime.toLowerCase()) {
[64] Fix | Delete
dfd.resolve(canvas.toDataURL(toMime), canvas);
[65] Fix | Delete
} else {
[66] Fix | Delete
dfd.reject();
[67] Fix | Delete
}
[68] Fix | Delete
};
[69] Fix | Delete
[70] Fix | Delete
img.src = src;
[71] Fix | Delete
$(img).on('load', function() {
[72] Fix | Delete
try {
[73] Fix | Delete
canvas.width = img.width;
[74] Fix | Delete
canvas.height = img.height;
[75] Fix | Delete
ctx.drawImage(img, 0, 0);
[76] Fix | Delete
conv();
[77] Fix | Delete
} catch(e) {
[78] Fix | Delete
dfd.reject();
[79] Fix | Delete
}
[80] Fix | Delete
}).on('error', function () {
[81] Fix | Delete
dfd.reject();
[82] Fix | Delete
});
[83] Fix | Delete
return dfd;
[84] Fix | Delete
} catch(e) {
[85] Fix | Delete
return dfd.reject();
[86] Fix | Delete
}
[87] Fix | Delete
},
[88] Fix | Delete
initImgTag = function(id, file, content, fm) {
[89] Fix | Delete
var node = $(this).children('img:first').data('ext', getExtention(file.mime, fm)),
[90] Fix | Delete
spnr = $('<div class="elfinder-edit-spinner elfinder-edit-image"></div>')
[91] Fix | Delete
.html('<span class="elfinder-spinner-text">' + fm.i18n('ntfloadimg') + '</span><span class="elfinder-spinner"></span>')
[92] Fix | Delete
.hide()
[93] Fix | Delete
.appendTo(this),
[94] Fix | Delete
setup = function() {
[95] Fix | Delete
node.attr('id', id+'-img')
[96] Fix | Delete
.attr('src', url || content)
[97] Fix | Delete
.css({'height':'', 'max-width':'100%', 'max-height':'100%', 'cursor':'pointer'})
[98] Fix | Delete
.data('loading', function(done) {
[99] Fix | Delete
var btns = node.closest('.elfinder-dialog').find('button,.elfinder-titlebar-button');
[100] Fix | Delete
btns.prop('disabled', !done)[done? 'removeClass' : 'addClass']('ui-state-disabled');
[101] Fix | Delete
node.css('opacity', done? '' : '0.3');
[102] Fix | Delete
spnr[done? 'hide' : 'show']();
[103] Fix | Delete
return node;
[104] Fix | Delete
});
[105] Fix | Delete
},
[106] Fix | Delete
url;
[107] Fix | Delete
[108] Fix | Delete
if (!content.match(/^data:/)) {
[109] Fix | Delete
fm.openUrl(file.hash, false, function(v) {
[110] Fix | Delete
url = v;
[111] Fix | Delete
node.attr('_src', content);
[112] Fix | Delete
setup();
[113] Fix | Delete
});
[114] Fix | Delete
} else {
[115] Fix | Delete
setup();
[116] Fix | Delete
}
[117] Fix | Delete
},
[118] Fix | Delete
imgBase64 = function(node, mime) {
[119] Fix | Delete
var style = node.attr('style'),
[120] Fix | Delete
img, canvas, ctx, data;
[121] Fix | Delete
try {
[122] Fix | Delete
// reset css for getting image size
[123] Fix | Delete
node.attr('style', '');
[124] Fix | Delete
// img node
[125] Fix | Delete
img = node.get(0);
[126] Fix | Delete
// New Canvas
[127] Fix | Delete
canvas = document.createElement('canvas');
[128] Fix | Delete
canvas.width = img.width;
[129] Fix | Delete
canvas.height = img.height;
[130] Fix | Delete
// restore css
[131] Fix | Delete
node.attr('style', style);
[132] Fix | Delete
// Draw Image
[133] Fix | Delete
canvas.getContext('2d').drawImage(img, 0, 0);
[134] Fix | Delete
// To Base64
[135] Fix | Delete
data = canvas.toDataURL(mime);
[136] Fix | Delete
} catch(e) {
[137] Fix | Delete
data = node.attr('src');
[138] Fix | Delete
}
[139] Fix | Delete
return data;
[140] Fix | Delete
},
[141] Fix | Delete
iframeClose = function(ifm) {
[142] Fix | Delete
var $ifm = $(ifm),
[143] Fix | Delete
dfd = $.Deferred().always(function() {
[144] Fix | Delete
$ifm.off('load', load);
[145] Fix | Delete
}),
[146] Fix | Delete
ab = 'about:blank',
[147] Fix | Delete
chk = function() {
[148] Fix | Delete
tm = setTimeout(function() {
[149] Fix | Delete
var src;
[150] Fix | Delete
try {
[151] Fix | Delete
src = base.contentWindow.location.href;
[152] Fix | Delete
} catch(e) {
[153] Fix | Delete
src = null;
[154] Fix | Delete
}
[155] Fix | Delete
if (src === ab) {
[156] Fix | Delete
dfd.resolve();
[157] Fix | Delete
} else if (--cnt > 0){
[158] Fix | Delete
chk();
[159] Fix | Delete
} else {
[160] Fix | Delete
dfd.reject();
[161] Fix | Delete
}
[162] Fix | Delete
}, 500);
[163] Fix | Delete
},
[164] Fix | Delete
load = function() {
[165] Fix | Delete
tm && clearTimeout(tm);
[166] Fix | Delete
dfd.resolve();
[167] Fix | Delete
},
[168] Fix | Delete
cnt = 20, // 500ms * 20 = 10sec wait
[169] Fix | Delete
tm;
[170] Fix | Delete
$ifm.one('load', load);
[171] Fix | Delete
ifm.src = ab;
[172] Fix | Delete
chk();
[173] Fix | Delete
return dfd;
[174] Fix | Delete
};
[175] Fix | Delete
[176] Fix | Delete
// check getfile callback function
[177] Fix | Delete
if (getfile) {
[178] Fix | Delete
getfile = getfile[1];
[179] Fix | Delete
if (getfile === 'ckeditor') {
[180] Fix | Delete
elFinder.prototype._options.getFileCallback = function(file, fm) {
[181] Fix | Delete
window.opener.CKEDITOR.tools.callFunction((function() {
[182] Fix | Delete
var reParam = new RegExp('(?:[?&]|&amp;)CKEditorFuncNum=([^&]+)', 'i'),
[183] Fix | Delete
match = window.location.search.match(reParam);
[184] Fix | Delete
return (match && match.length > 1) ? match[1] : '';
[185] Fix | Delete
})(), fm.convAbsUrl(file.url));
[186] Fix | Delete
fm.destroy();
[187] Fix | Delete
window.close();
[188] Fix | Delete
};
[189] Fix | Delete
}
[190] Fix | Delete
}
[191] Fix | Delete
[192] Fix | Delete
// return editors Array
[193] Fix | Delete
return [
[194] Fix | Delete
{
[195] Fix | Delete
// tui.image-editor - https://github.com/nhnent/tui.image-editor
[196] Fix | Delete
info : {
[197] Fix | Delete
id: 'tuiimgedit',
[198] Fix | Delete
name: 'TUI Image Editor',
[199] Fix | Delete
iconImg: 'img/editor-icons.png 0 -48',
[200] Fix | Delete
dataScheme: true,
[201] Fix | Delete
schemeContent: true,
[202] Fix | Delete
openMaximized: true,
[203] Fix | Delete
canMakeEmpty: false,
[204] Fix | Delete
integrate: {
[205] Fix | Delete
title: 'TOAST UI Image Editor',
[206] Fix | Delete
link: 'http://ui.toast.com/tui-image-editor/'
[207] Fix | Delete
}
[208] Fix | Delete
},
[209] Fix | Delete
// MIME types to accept
[210] Fix | Delete
mimes : ['image/jpeg', 'image/png', 'image/gif', 'image/svg+xml', 'image/x-ms-bmp'],
[211] Fix | Delete
// HTML of this editor
[212] Fix | Delete
html : '<div class="elfinder-edit-imageeditor"><canvas></canvas></div>',
[213] Fix | Delete
// called on initialization of elFinder cmd edit (this: this editor's config object)
[214] Fix | Delete
setup : function(opts, fm) {
[215] Fix | Delete
if (fm.UA.ltIE8 || fm.UA.Mobile) {
[216] Fix | Delete
this.disabled = true;
[217] Fix | Delete
} else {
[218] Fix | Delete
this.opts = Object.assign({
[219] Fix | Delete
version: 'v3.15.3'
[220] Fix | Delete
}, opts.extraOptions.tuiImgEditOpts || {}, {
[221] Fix | Delete
iconsPath : fm.baseUrl + 'img/tui-',
[222] Fix | Delete
theme : {}
[223] Fix | Delete
});
[224] Fix | Delete
if (!fm.isSameOrigin(this.opts.iconsPath)) {
[225] Fix | Delete
this.disabled = true;
[226] Fix | Delete
fm.debug('warning', 'Setting `commandOptions.edit.extraOptions.tuiImgEditOpts.iconsPath` MUST follow the same origin policy.');
[227] Fix | Delete
}
[228] Fix | Delete
}
[229] Fix | Delete
},
[230] Fix | Delete
// Initialization of editing node (this: this editors HTML node)
[231] Fix | Delete
init : function(id, file, content, fm) {
[232] Fix | Delete
this.data('url', content);
[233] Fix | Delete
},
[234] Fix | Delete
load : function(base) {
[235] Fix | Delete
var self = this,
[236] Fix | Delete
fm = this.fm,
[237] Fix | Delete
dfrd = $.Deferred(),
[238] Fix | Delete
cdns = fm.options.cdns,
[239] Fix | Delete
ver = self.confObj.opts.version,
[240] Fix | Delete
init = function(editor) {
[241] Fix | Delete
var $base = $(base),
[242] Fix | Delete
bParent = $base.parent(),
[243] Fix | Delete
opts = self.confObj.opts,
[244] Fix | Delete
iconsPath = opts.iconsPath,
[245] Fix | Delete
tmpContainer = $('<div class="tui-image-editor-container">').appendTo(bParent),
[246] Fix | Delete
tmpDiv = [
[247] Fix | Delete
$('<div class="tui-image-editor-submenu"></div>').appendTo(tmpContainer),
[248] Fix | Delete
$('<div class="tui-image-editor-controls"></div>').appendTo(tmpContainer)
[249] Fix | Delete
],
[250] Fix | Delete
iEditor = new editor(base, {
[251] Fix | Delete
includeUI: {
[252] Fix | Delete
loadImage: {
[253] Fix | Delete
path: $base.data('url'),
[254] Fix | Delete
name: self.file.name
[255] Fix | Delete
},
[256] Fix | Delete
theme: opts.theme,
[257] Fix | Delete
initMenu: 'filter',
[258] Fix | Delete
menuBarPosition: 'bottom'
[259] Fix | Delete
},
[260] Fix | Delete
cssMaxWidth: Math.max(300, bParent.width()),
[261] Fix | Delete
cssMaxHeight: Math.max(200, bParent.height() - (tmpDiv[0].height() + tmpDiv[1].height() + 3 /*margin*/)),
[262] Fix | Delete
usageStatistics: false
[263] Fix | Delete
}),
[264] Fix | Delete
canvas = $base.find('canvas:first').get(0),
[265] Fix | Delete
zoom = function(v) {
[266] Fix | Delete
if (typeof v !== 'undefined') {
[267] Fix | Delete
var c = $(canvas),
[268] Fix | Delete
w = parseInt(c.attr('width')),
[269] Fix | Delete
h = parseInt(c.attr('height')),
[270] Fix | Delete
a = w / h,
[271] Fix | Delete
z, mw, mh;
[272] Fix | Delete
if (v === 0) {
[273] Fix | Delete
mw = w;
[274] Fix | Delete
mh = h;
[275] Fix | Delete
} else {
[276] Fix | Delete
mw = parseInt(c.css('max-width')) + Number(v);
[277] Fix | Delete
mh = mw / a;
[278] Fix | Delete
if (mw > w && mh > h) {
[279] Fix | Delete
mw = w;
[280] Fix | Delete
mh = h;
[281] Fix | Delete
}
[282] Fix | Delete
}
[283] Fix | Delete
z = Math.round(mw / w * 100);
[284] Fix | Delete
// Control zoom button of TUI Image Editor
[285] Fix | Delete
if (z < 100) {
[286] Fix | Delete
iEditor.resetZoom();
[287] Fix | Delete
iEditor.stopDrawingMode();
[288] Fix | Delete
tuiZoomCtrls.hide();
[289] Fix | Delete
} else {
[290] Fix | Delete
tuiZoomCtrls.show();
[291] Fix | Delete
}
[292] Fix | Delete
per.text(z + '%');
[293] Fix | Delete
iEditor.resizeCanvasDimension({width: mw, height: mh});
[294] Fix | Delete
// continually change more
[295] Fix | Delete
if (zoomMore) {
[296] Fix | Delete
setTimeout(function() {
[297] Fix | Delete
zoomMore && zoom(v);
[298] Fix | Delete
}, 50);
[299] Fix | Delete
}
[300] Fix | Delete
}
[301] Fix | Delete
},
[302] Fix | Delete
zup = $('<span class="ui-icon ui-icon-plusthick"></span>').data('val', 10),
[303] Fix | Delete
zdown = $('<span class="ui-icon ui-icon-minusthick"></span>').data('val', -10),
[304] Fix | Delete
per = $('<button></button>').css('width', '4em').text('%').attr('title', '100%').data('val', 0),
[305] Fix | Delete
tuiZoomCtrls,
[306] Fix | Delete
quty, qutyTm, zoomTm, zoomMore;
[307] Fix | Delete
[308] Fix | Delete
tmpContainer.remove();
[309] Fix | Delete
$base.removeData('url').data('mime', self.file.mime);
[310] Fix | Delete
// jpeg quality controls
[311] Fix | Delete
if (self.file.mime === 'image/jpeg') {
[312] Fix | Delete
$base.data('quality', fm.storage('jpgQuality') || fm.option('jpgQuality'));
[313] Fix | Delete
quty = $('<input type="number" class="ui-corner-all elfinder-resize-quality elfinder-tabstop"/>')
[314] Fix | Delete
.attr('min', '1')
[315] Fix | Delete
.attr('max', '100')
[316] Fix | Delete
.attr('title', '1 - 100')
[317] Fix | Delete
.on('change', function() {
[318] Fix | Delete
var q = quty.val();
[319] Fix | Delete
$base.data('quality', q);
[320] Fix | Delete
qutyTm && cancelAnimationFrame(qutyTm);
[321] Fix | Delete
qutyTm = requestAnimationFrame(function() {
[322] Fix | Delete
canvas.toBlob(function(blob) {
[323] Fix | Delete
blob && quty.next('span').text(' (' + fm.formatSize(blob.size) + ')');
[324] Fix | Delete
}, 'image/jpeg', Math.max(Math.min(q, 100), 1) / 100);
[325] Fix | Delete
});
[326] Fix | Delete
})
[327] Fix | Delete
.val($base.data('quality'));
[328] Fix | Delete
$('<div class="ui-dialog-buttonset elfinder-edit-extras elfinder-edit-extras-quality"></div>')
[329] Fix | Delete
.append(
[330] Fix | Delete
$('<span>').html(fm.i18n('quality') + ' : '), quty, $('<span></span>')
[331] Fix | Delete
)
[332] Fix | Delete
.prependTo($base.parent().next());
[333] Fix | Delete
} else if (self.file.mime === 'image/svg+xml') {
[334] Fix | Delete
$base.closest('.ui-dialog').trigger('changeType', {
[335] Fix | Delete
extention: 'png',
[336] Fix | Delete
mime : 'image/png',
[337] Fix | Delete
keepEditor: true
[338] Fix | Delete
});
[339] Fix | Delete
}
[340] Fix | Delete
// zoom scale controls
[341] Fix | Delete
$('<div class="ui-dialog-buttonset elfinder-edit-extras"></div>')
[342] Fix | Delete
.append(
[343] Fix | Delete
zdown, per, zup
[344] Fix | Delete
)
[345] Fix | Delete
.attr('title', fm.i18n('scale'))
[346] Fix | Delete
.on('click', 'span,button', function() {
[347] Fix | Delete
zoom($(this).data('val'));
[348] Fix | Delete
})
[349] Fix | Delete
.on('mousedown mouseup mouseleave', 'span', function(e) {
[350] Fix | Delete
zoomMore = false;
[351] Fix | Delete
zoomTm && clearTimeout(zoomTm);
[352] Fix | Delete
if (e.type === 'mousedown') {
[353] Fix | Delete
zoomTm = setTimeout(function() {
[354] Fix | Delete
zoomMore = true;
[355] Fix | Delete
zoom($(e.target).data('val'));
[356] Fix | Delete
}, 500);
[357] Fix | Delete
}
[358] Fix | Delete
})
[359] Fix | Delete
.prependTo($base.parent().next());
[360] Fix | Delete
[361] Fix | Delete
// wait canvas ready
[362] Fix | Delete
setTimeout(function() {
[363] Fix | Delete
dfrd.resolve(iEditor);
[364] Fix | Delete
if (quty) {
[365] Fix | Delete
quty.trigger('change');
[366] Fix | Delete
iEditor.on('redoStackChanged undoStackChanged', function() {
[367] Fix | Delete
quty.trigger('change');
[368] Fix | Delete
});
[369] Fix | Delete
}
[370] Fix | Delete
// ZOOM controls of TUI Image Editor
[371] Fix | Delete
tuiZoomCtrls = $base.find('.tie-btn-zoomIn,.tie-btn-zoomOut,.tie-btn-hand');
[372] Fix | Delete
// show initial scale
[373] Fix | Delete
zoom(null);
[374] Fix | Delete
}, 100);
[375] Fix | Delete
[376] Fix | Delete
// show color slider (maybe TUI-Image-Editor's bug)
[377] Fix | Delete
// see https://github.com/nhn/tui.image-editor/issues/153
[378] Fix | Delete
$base.find('.tui-colorpicker-palette-container').on('click', '.tui-colorpicker-palette-preview', function() {
[379] Fix | Delete
$(this).closest('.color-picker-control').height('auto').find('.tui-colorpicker-slider-container').toggle();
[380] Fix | Delete
});
[381] Fix | Delete
$base.on('click', function() {
[382] Fix | Delete
$base.find('.tui-colorpicker-slider-container').hide();
[383] Fix | Delete
});
[384] Fix | Delete
},
[385] Fix | Delete
loader;
[386] Fix | Delete
[387] Fix | Delete
if (!self.confObj.editor) {
[388] Fix | Delete
loader = $.Deferred();
[389] Fix | Delete
fm.loadCss([
[390] Fix | Delete
cdns.tui + '/tui-color-picker/latest/tui-color-picker.css',
[391] Fix | Delete
cdns.tui + '/tui-image-editor/'+ver+'/tui-image-editor.css'
[392] Fix | Delete
]);
[393] Fix | Delete
if (fm.hasRequire) {
[394] Fix | Delete
require.config({
[395] Fix | Delete
paths : {
[396] Fix | Delete
'fabric/dist/fabric.require' : cdns.fabric + '/fabric.require.min', // for fabric < 2.0.1
[397] Fix | Delete
'fabric' : cdns.fabric + '/fabric.min', // for fabric >= 2.0.1
[398] Fix | Delete
'tui-code-snippet' : cdns.tui + '/tui.code-snippet/latest/tui-code-snippet.min',
[399] Fix | Delete
'tui-color-picker' : cdns.tui + '/tui-color-picker/latest/tui-color-picker.min',
[400] Fix | Delete
'tui-image-editor' : cdns.tui + '/tui-image-editor/'+ver+'/tui-image-editor.min'
[401] Fix | Delete
}
[402] Fix | Delete
});
[403] Fix | Delete
require(['tui-image-editor'], function(ImageEditor) {
[404] Fix | Delete
loader.resolve(ImageEditor);
[405] Fix | Delete
});
[406] Fix | Delete
} else {
[407] Fix | Delete
fm.loadScript([
[408] Fix | Delete
cdns.fabric + '/fabric.min.js',
[409] Fix | Delete
cdns.tui + '/tui.code-snippet/latest/tui-code-snippet.min.js'
[410] Fix | Delete
], function() {
[411] Fix | Delete
fm.loadScript([
[412] Fix | Delete
cdns.tui + '/tui-color-picker/latest/tui-color-picker.min.js'
[413] Fix | Delete
], function() {
[414] Fix | Delete
fm.loadScript([
[415] Fix | Delete
cdns.tui + '/tui-image-editor/'+ver+'/tui-image-editor.min.js'
[416] Fix | Delete
], function() {
[417] Fix | Delete
loader.resolve(window.tui.ImageEditor);
[418] Fix | Delete
}, {
[419] Fix | Delete
loadType: 'tag'
[420] Fix | Delete
});
[421] Fix | Delete
}, {
[422] Fix | Delete
loadType: 'tag'
[423] Fix | Delete
});
[424] Fix | Delete
}, {
[425] Fix | Delete
loadType: 'tag'
[426] Fix | Delete
});
[427] Fix | Delete
}
[428] Fix | Delete
loader.done(function(editor) {
[429] Fix | Delete
self.confObj.editor = editor;
[430] Fix | Delete
init(editor);
[431] Fix | Delete
});
[432] Fix | Delete
} else {
[433] Fix | Delete
init(self.confObj.editor);
[434] Fix | Delete
}
[435] Fix | Delete
return dfrd;
[436] Fix | Delete
},
[437] Fix | Delete
getContent : function(base) {
[438] Fix | Delete
var editor = this.editor,
[439] Fix | Delete
fm = editor.fm,
[440] Fix | Delete
$base = $(base),
[441] Fix | Delete
quality = $base.data('quality');
[442] Fix | Delete
if (editor.instance) {
[443] Fix | Delete
if ($base.data('mime') === 'image/jpeg') {
[444] Fix | Delete
quality = quality || fm.storage('jpgQuality') || fm.option('jpgQuality');
[445] Fix | Delete
quality = Math.max(0.1, Math.min(1, quality / 100));
[446] Fix | Delete
}
[447] Fix | Delete
return editor.instance.toDataURL({
[448] Fix | Delete
format: getExtention($base.data('mime'), fm, true),
[449] Fix | Delete
quality: quality
[450] Fix | Delete
});
[451] Fix | Delete
}
[452] Fix | Delete
},
[453] Fix | Delete
save : function(base) {
[454] Fix | Delete
var $base = $(base),
[455] Fix | Delete
quality = $base.data('quality'),
[456] Fix | Delete
hash = $base.data('hash'),
[457] Fix | Delete
file;
[458] Fix | Delete
this.instance.deactivateAll();
[459] Fix | Delete
if (typeof quality !== 'undefined') {
[460] Fix | Delete
this.fm.storage('jpgQuality', quality);
[461] Fix | Delete
}
[462] Fix | Delete
if (hash) {
[463] Fix | Delete
file = this.fm.file(hash);
[464] Fix | Delete
$base.data('mime', file.mime);
[465] Fix | Delete
}
[466] Fix | Delete
}
[467] Fix | Delete
},
[468] Fix | Delete
{
[469] Fix | Delete
// Photopea advanced image editor
[470] Fix | Delete
info : {
[471] Fix | Delete
id : 'photopea',
[472] Fix | Delete
name : 'Photopea',
[473] Fix | Delete
iconImg : 'img/editor-icons.png 0 -160',
[474] Fix | Delete
single: true,
[475] Fix | Delete
noContent: true,
[476] Fix | Delete
arrayBufferContent: true,
[477] Fix | Delete
openMaximized: true,
[478] Fix | Delete
// Disable file types that cannot be saved on Photopea.
[479] Fix | Delete
canMakeEmpty: ['image/jpeg', 'image/png', 'image/gif', 'image/svg+xml', 'image/x-ms-bmp', 'image/tiff', /*'image/x-adobe-dng',*/ 'image/webp', /*'image/x-xcf',*/ 'image/vnd.adobe.photoshop', 'application/pdf', 'image/x-portable-pixmap', 'image/x-sketch', 'image/x-icon', 'image/vnd-ms.dds', /*'application/x-msmetafile'*/],
[480] Fix | Delete
integrate: {
[481] Fix | Delete
title: 'Photopea',
[482] Fix | Delete
link: 'https://www.photopea.com/learn/'
[483] Fix | Delete
}
[484] Fix | Delete
},
[485] Fix | Delete
mimes : ['image/jpeg', 'image/png', 'image/gif', 'image/svg+xml', 'image/x-ms-bmp', 'image/tiff', 'image/x-adobe-dng', 'image/webp', 'image/x-xcf', 'image/vnd.adobe.photoshop', 'application/pdf', 'image/x-portable-pixmap', 'image/x-sketch', 'image/x-icon', 'image/vnd-ms.dds', 'application/x-msmetafile'],
[486] Fix | Delete
html : '<iframe style="width:100%;height:100%;border:none;"></iframe>',
[487] Fix | Delete
// setup on elFinder bootup
[488] Fix | Delete
setup : function(opts, fm) {
[489] Fix | Delete
if (fm.UA.IE || fm.UA.Mobile) {
[490] Fix | Delete
this.disabled = true;
[491] Fix | Delete
}
[492] Fix | Delete
},
[493] Fix | Delete
// Initialization of editing node (this: this editors HTML node)
[494] Fix | Delete
init : function(id, file, dum, fm) {
[495] Fix | Delete
var orig = 'https://www.photopea.com',
[496] Fix | Delete
ifm = $(this).hide()
[497] Fix | Delete
//.css('box-sizing', 'border-box')
[498] Fix | Delete
.on('load', function() {
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function