Standardize media-tag embedder and make media tags always absolute URL, Standardize import/export logic for codemirror apps, fix arrow key navigation in presentation fullscreen mode before first click.

This commit is contained in:
Caleb James DeLisle
2017-10-03 17:57:57 +03:00
parent 94d2f4472b
commit d6570ad9f2
6 changed files with 111 additions and 157 deletions

View File

@@ -363,35 +363,11 @@ define([
if (href) { ifrWindow.open(bounceHref, '_blank'); }
};
if (!framework.isReadOnly()) {
framework.onEditableChange(function () {
var locked = framework.isLocked();
$(inner).css({ 'background-color': ((locked) ? '#aaa' : '') });
inner.setAttribute('contenteditable', !locked);
});
var fileDialogCfg = {
onSelect: function (data) {
if (data.type === 'file') {
var mt = '<media-tag contenteditable="false" src="' + data.src + '" data-crypto-key="cryptpad:' + data.key + '" tabindex="1"></media-tag>';
editor.insertElement(window.CKEDITOR.dom.element.createFromHtml(mt));
return;
}
}
};
framework._.sfCommon.initFilePicker(fileDialogCfg);
window.APP.$mediaTagButton = $('<button>', {
title: Messages.filePickerButton,
'class': 'cp-toolbar-rightside-button fa fa-picture-o',
style: 'font-size: 17px'
}).click(function () {
var pickerCfg = {
types: ['file'],
where: ['root']
};
framework._.sfCommon.openFilePicker(pickerCfg);
}).appendTo(framework._.toolbar.$rightside);
}
framework.setMediaTagEmbedder(function ($mt) {
$mt.attr('contenteditable', 'false');
$mt.attr('tabindex', '1');
editor.insertElement(new window.CKEDITOR.dom.element($mt[0]));
});
framework.setTitleRecommender(function () {
var text;