From d975bb9cc00543229515e58bfc87b9862775dc47 Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 28 Feb 2018 13:16:30 +0100 Subject: [PATCH] Fix focus after pad creation screen --- www/code/inner.js | 2 ++ www/pad/inner.js | 22 +++++++++++++++++----- www/slide/inner.js | 2 ++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/www/code/inner.js b/www/code/inner.js index 091baa0e8..d7a9b25e4 100644 --- a/www/code/inner.js +++ b/www/code/inner.js @@ -327,6 +327,8 @@ define([ framework.setTitleRecommender(CodeMirror.getHeadingText); framework.onReady(function (newPad) { + editor.focus(); + if (newPad && !CodeMirror.highlightMode) { CodeMirror.setMode('gfm', evModeChange.fire); //console.log("%s => %s", CodeMirror.highlightMode, CodeMirror.$language.val()); diff --git a/www/pad/inner.js b/www/pad/inner.js index c1a2adbf2..5ca7c24f6 100644 --- a/www/pad/inner.js +++ b/www/pad/inner.js @@ -437,6 +437,8 @@ define([ } framework.onReady(function (newPad) { + editor.focus(); + if (!module.isMaximized) { module.isMaximized = true; $('iframe.cke_wysiwyg_frame').css('width', ''); @@ -444,7 +446,6 @@ define([ } $('body').addClass('app-pad'); - editor.focus(); if (newPad) { cursor.setToEnd(); } else if (framework.isReadOnly()) { @@ -474,9 +475,18 @@ define([ $iframe.find('html').addClass('cke_body_width'); } }); + /*setTimeout(function () { + $('iframe.cke_wysiwyg_frame').focus(); + editor.focus(); + console.log(editor); + console.log(editor.focusManager); + $(window).trigger('resize'); + });*/ }); - framework.onDefaultContentNeeded(function () { }); + framework.onDefaultContentNeeded(function () { + inner.innerHTML = '

'; + }); var importMediaTags = function (dom, cb) { var $dom = $(dom); @@ -616,9 +626,11 @@ define([ var backColor = AppConfig.appBackgroundColor; var newCss = '.cke_body_width { background: '+ backColor +'; height: 100%; }' + '.cke_body_width body {' + - 'max-width: 50em; padding: 10px 30px; margin: 0 auto; min-height: 100%;'+ - 'box-sizing: border-box;'+ - '}'; + 'max-width: 50em; padding: 20px 30px; margin: 0 auto; min-height: 100%;'+ + 'box-sizing: border-box; overflow: auto;'+ + '}' + + 'html.cke_body_width { overflow: hidden; }' + + '.cke_body_width body > *:first-child { margin-top: 0; }'; Ckeditor.addCss(newCss); Ckeditor.plugins.addExternal('mediatag','/pad/', 'mediatag-plugin.js'); module.ckeditor = editor = Ckeditor.replace('editor1', { diff --git a/www/slide/inner.js b/www/slide/inner.js index b41496024..6ef545dff 100644 --- a/www/slide/inner.js +++ b/www/slide/inner.js @@ -502,6 +502,8 @@ define([ }); framework.onReady(function (/*newPad*/) { + editor.focus(); + CodeMirror.setMode('markdown', function () { }); Slide.onChange(function (o, n, l) { var slideNumber = '';