From d6570ad9f2bc5b2c6c49250f823f4bdcfbdc284b Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Tue, 3 Oct 2017 17:57:57 +0300 Subject: [PATCH] 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. --- www/code/inner.js | 80 ++++++-------------------- www/common/sframe-app-framework.js | 47 +++++++++++++++ www/common/sframe-common-codemirror.js | 41 +++++-------- www/pad/inner.js | 34 ++--------- www/slide/inner.js | 63 ++++++++------------ www/slide/slide.js | 3 + 6 files changed, 111 insertions(+), 157 deletions(-) diff --git a/www/code/inner.js b/www/code/inner.js index 97a044f4c..519e76bfa 100644 --- a/www/code/inner.js +++ b/www/code/inner.js @@ -204,6 +204,20 @@ define([ updateIndentSettings(); }; + var mkFilePicker = function (framework, editor, evModeChange) { + evModeChange.reg(function (mode) { + if (MEDIA_TAG_MODES.indexOf(mode) !== -1) { + // Embedding is endabled + framework.setMediaTagEmbedder(function (mt) { + editor.replaceSelection($(mt)[0].outerHTML); + }); + } else { + // Embedding is disabled + framework.setMediaTagEmbedder(); + } + }); + }; + ///////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -211,7 +225,6 @@ define([ var andThen2 = function (editor, CodeMirror, framework) { - var $toolbarContainer = $('#cme_toolbox'); var common = framework._.sfCommon; var previewPane = mkPreviewPane(editor, CodeMirror, framework); @@ -220,37 +233,7 @@ define([ mkIndentSettings(editor, framework._.cpNfInner.metadataMgr); CodeMirror.init(framework.localChange, framework._.title, framework._.toolbar); - - if (!framework.isReadOnly()) { - var fileDialogCfg = { - onSelect: function (data) { - if (data.type === 'file') { - var mt = ''; - editor.replaceSelection(mt); - return; - } - } - }; - common.initFilePicker(fileDialogCfg); - var $mediaTagButton = $('