Move base64 migration prompt to corner and only when the pad is stored
This commit is contained in:
parent
7b06626581
commit
264f7dc6a1
5 changed files with 46 additions and 27 deletions
|
@ -81,6 +81,10 @@
|
|||
line-height: 200px;
|
||||
}
|
||||
}
|
||||
&.cp-corner-big {
|
||||
width: 400px;
|
||||
height: 250px;
|
||||
}
|
||||
|
||||
.cp-corner-actions {
|
||||
min-height: 30px;
|
||||
|
|
|
@ -222,6 +222,7 @@ define(function () {
|
|||
out.notifyRenamed = "{0} is now known as {1}";
|
||||
out.notifyLeft = "{0} has left the collaborative session";
|
||||
|
||||
out.ok = 'OK';
|
||||
out.okButton = 'OK (enter)';
|
||||
|
||||
out.cancel = "Cancel";
|
||||
|
|
|
@ -879,7 +879,9 @@ define([
|
|||
|
||||
UI.createRadio = Pages.createRadio;
|
||||
|
||||
UI.cornerPopup = function (text, actions, footer, startHidden) {
|
||||
UI.cornerPopup = function (text, actions, footer, opts) {
|
||||
opts = opts || {};
|
||||
|
||||
var minimize = h('div.cp-corner-minimize.fa.fa-window-minimize');
|
||||
var maximize = h('div.cp-corner-maximize.fa.fa-window-maximize');
|
||||
var popup = h('div.cp-corner-container', [
|
||||
|
@ -902,9 +904,12 @@ define([
|
|||
$(popup).removeClass('cp-minimized');
|
||||
});
|
||||
|
||||
if (startHidden) {
|
||||
if (opts.hidden) {
|
||||
$(popup).addClass('cp-minimized');
|
||||
}
|
||||
if (opts.big) {
|
||||
$(popup).addClass('cp-corner-big');
|
||||
}
|
||||
|
||||
var hide = function () {
|
||||
$(popup).hide();
|
||||
|
|
|
@ -2335,13 +2335,10 @@ define([
|
|||
|
||||
var hide = h('button.cp-corner-cancel', Messages.autostore_hide);
|
||||
var store = h('button.cp-corner-primary', Messages.autostore_store);
|
||||
var actions = h('div', [
|
||||
store,
|
||||
hide,
|
||||
]);
|
||||
var actions = h('div', [store, hide]);
|
||||
|
||||
var initialHide = data && data.autoStore && data.autoStore === -1;
|
||||
var modal = UI.cornerPopup(text, actions, footer, initialHide);
|
||||
var modal = UI.cornerPopup(text, actions, footer, {hidden: initialHide});
|
||||
|
||||
$(modal.popup).find('.cp-corner-footer a').click(function (e) {
|
||||
e.preventDefault();
|
||||
|
|
|
@ -31,6 +31,7 @@ define([
|
|||
'/common/common-hash.js',
|
||||
'/common/common-util.js',
|
||||
'/common/common-interface.js',
|
||||
'/common/hyperscript.js',
|
||||
'/bower_components/chainpad/chainpad.dist.js',
|
||||
'/customize/application_config.js',
|
||||
'/common/test.js',
|
||||
|
@ -54,6 +55,7 @@ define([
|
|||
Hash,
|
||||
Util,
|
||||
UI,
|
||||
h,
|
||||
ChainPad,
|
||||
AppConfig,
|
||||
Test
|
||||
|
@ -588,27 +590,37 @@ define([
|
|||
}
|
||||
});
|
||||
|
||||
var b64images = $(inner).find('img[src^="data:image"]:not(.cke_reset)');
|
||||
if (b64images.length) {
|
||||
UI.confirm(Messages.pad_base64, function (yes) {
|
||||
if (!yes) { return; }
|
||||
b64images.each(function (i, el) {
|
||||
var src = $(el).attr('src');
|
||||
var blob = Util.dataURIToBlob(src);
|
||||
var ext = '.' + (blob.type.split('/')[1] || 'png');
|
||||
var name = framework._.title.getTitle()+'_image' || 'Pad_image';
|
||||
blob.name = name + ext;
|
||||
var ev = {
|
||||
insertElement: function (newEl) {
|
||||
var element = new window.CKEDITOR.dom.element(el);
|
||||
newEl.replace(element);
|
||||
setTimeout(framework.localChange);
|
||||
}
|
||||
};
|
||||
window.APP.FM.handleFile(blob, ev);
|
||||
framework._.sfCommon.isPadStored(function (err, val) {
|
||||
if (!val) { return; }
|
||||
var b64images = $(inner).find('img[src^="data:image"]:not(.cke_reset)');
|
||||
if (b64images.length && framework._.sfCommon.isLoggedIn()) {
|
||||
var no = h('button.cp-corner-cancel', Messages.cancel);
|
||||
var yes = h('button.cp-corner-primary', Messages.ok);
|
||||
var actions = h('div', [yes, no]);
|
||||
var modal = UI.cornerPopup(Messages.pad_base64, actions, '', {big: true});
|
||||
$(no).click(function () {
|
||||
modal.delete();
|
||||
});
|
||||
});
|
||||
}
|
||||
$(yes).click(function () {
|
||||
modal.delete();
|
||||
b64images.each(function (i, el) {
|
||||
var src = $(el).attr('src');
|
||||
var blob = Util.dataURIToBlob(src);
|
||||
var ext = '.' + (blob.type.split('/')[1] || 'png');
|
||||
var name = (framework._.title.getTitle() || 'Pad')+'_image';
|
||||
blob.name = name + ext;
|
||||
var ev = {
|
||||
insertElement: function (newEl) {
|
||||
var element = new window.CKEDITOR.dom.element(el);
|
||||
newEl.replace(element);
|
||||
setTimeout(framework.localChange);
|
||||
}
|
||||
};
|
||||
window.APP.FM.handleFile(blob, ev);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
/*setTimeout(function () {
|
||||
$('iframe.cke_wysiwyg_frame').focus();
|
||||
editor.focus();
|
||||
|
|
Loading…
Reference in a new issue