Focus the editable content when opening a codemirror pad
parent
bafa401473
commit
47cfa0cf45
|
@ -163,14 +163,6 @@ define([
|
|||
content: textValue,
|
||||
metadata: metadataMgr.getMetadataLazy()
|
||||
};
|
||||
/* metadata: {
|
||||
users: UserList.userData,
|
||||
defaultTitle: Title.defaultTitle
|
||||
}
|
||||
};
|
||||
if (!initializing) {
|
||||
obj.metadata.title = Title.title;
|
||||
}*/
|
||||
// set mode too...
|
||||
obj.highlightMode = CodeMirror.highlightMode;
|
||||
|
||||
|
@ -428,9 +420,6 @@ define([
|
|||
//console.log("%s => %s", CodeMirror.highlightMode, CodeMirror.$language.val());
|
||||
}
|
||||
|
||||
// Update the user list (metadata) from the hyperjson
|
||||
//Metadata.update(userDoc);
|
||||
|
||||
if (newDoc) {
|
||||
editor.setValue(newDoc);
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ define([
|
|||
readOnly: true
|
||||
});
|
||||
editor.setValue(Messages.codeInitialState);
|
||||
editor.focus();
|
||||
|
||||
var setMode = exp.setMode = function (mode, cb) {
|
||||
exp.highlightMode = mode;
|
||||
|
|
|
@ -454,9 +454,13 @@ define([
|
|||
var metadataMgr = common.getMetadataMgr();
|
||||
var type = metadataMgr.getMetadataLazy().type;
|
||||
var sframeChan = common.getSframeChannel();
|
||||
var focus;
|
||||
|
||||
var onConfirm = function (yes) {
|
||||
if (!yes) { return; }
|
||||
if (!yes) {
|
||||
if (focus) { focus.focus(); }
|
||||
return;
|
||||
}
|
||||
var first = true; // We can only pick a template once (for a new document)
|
||||
var fileDialogCfg = {
|
||||
onSelect: function (data) {
|
||||
|
@ -467,6 +471,7 @@ define([
|
|||
Cryptpad.removeLoadingScreen();
|
||||
common.feedback('TEMPLATE_USED');
|
||||
});
|
||||
if (focus) { focus.focus(); }
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -481,6 +486,7 @@ define([
|
|||
|
||||
sframeChan.query("Q_TEMPLATE_EXIST", type, function (err, data) {
|
||||
if (data) {
|
||||
focus = document.activeElement;
|
||||
Cryptpad.confirm(Messages.useTemplate, onConfirm, {
|
||||
ok: Messages.useTemplateOK,
|
||||
cancel: Messages.useTemplateCancel,
|
||||
|
|
Loading…
Reference in New Issue