Fix focus after pad creation screen

pull/1/head
yflory 7 years ago
parent f0bc1cfe99
commit d975bb9cc0

@ -327,6 +327,8 @@ define([
framework.setTitleRecommender(CodeMirror.getHeadingText); framework.setTitleRecommender(CodeMirror.getHeadingText);
framework.onReady(function (newPad) { framework.onReady(function (newPad) {
editor.focus();
if (newPad && !CodeMirror.highlightMode) { if (newPad && !CodeMirror.highlightMode) {
CodeMirror.setMode('gfm', evModeChange.fire); CodeMirror.setMode('gfm', evModeChange.fire);
//console.log("%s => %s", CodeMirror.highlightMode, CodeMirror.$language.val()); //console.log("%s => %s", CodeMirror.highlightMode, CodeMirror.$language.val());

@ -437,6 +437,8 @@ define([
} }
framework.onReady(function (newPad) { framework.onReady(function (newPad) {
editor.focus();
if (!module.isMaximized) { if (!module.isMaximized) {
module.isMaximized = true; module.isMaximized = true;
$('iframe.cke_wysiwyg_frame').css('width', ''); $('iframe.cke_wysiwyg_frame').css('width', '');
@ -444,7 +446,6 @@ define([
} }
$('body').addClass('app-pad'); $('body').addClass('app-pad');
editor.focus();
if (newPad) { if (newPad) {
cursor.setToEnd(); cursor.setToEnd();
} else if (framework.isReadOnly()) { } else if (framework.isReadOnly()) {
@ -474,9 +475,18 @@ define([
$iframe.find('html').addClass('cke_body_width'); $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 = '<p></p>';
});
var importMediaTags = function (dom, cb) { var importMediaTags = function (dom, cb) {
var $dom = $(dom); var $dom = $(dom);
@ -616,9 +626,11 @@ define([
var backColor = AppConfig.appBackgroundColor; var backColor = AppConfig.appBackgroundColor;
var newCss = '.cke_body_width { background: '+ backColor +'; height: 100%; }' + var newCss = '.cke_body_width { background: '+ backColor +'; height: 100%; }' +
'.cke_body_width body {' + '.cke_body_width body {' +
'max-width: 50em; padding: 10px 30px; margin: 0 auto; min-height: 100%;'+ 'max-width: 50em; padding: 20px 30px; margin: 0 auto; min-height: 100%;'+
'box-sizing: border-box;'+ '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.addCss(newCss);
Ckeditor.plugins.addExternal('mediatag','/pad/', 'mediatag-plugin.js'); Ckeditor.plugins.addExternal('mediatag','/pad/', 'mediatag-plugin.js');
module.ckeditor = editor = Ckeditor.replace('editor1', { module.ckeditor = editor = Ckeditor.replace('editor1', {

@ -502,6 +502,8 @@ define([
}); });
framework.onReady(function (/*newPad*/) { framework.onReady(function (/*newPad*/) {
editor.focus();
CodeMirror.setMode('markdown', function () { }); CodeMirror.setMode('markdown', function () { });
Slide.onChange(function (o, n, l) { Slide.onChange(function (o, n, l) {
var slideNumber = ''; var slideNumber = '';

Loading…
Cancel
Save