feature(edit) add info text

This commit is contained in:
coderaiser 2018-09-08 23:07:49 +03:00
parent adbfb95012
commit 85e46bb94b
2 changed files with 25 additions and 0 deletions

View file

@ -74,6 +74,7 @@ module.exports.show = (options) => {
setMsgChanged(name); setMsgChanged(name);
CloudCmd.Edit CloudCmd.Edit
.setInfo(name)
.getEditor() .getEditor()
.setValueFirst(path, data) .setValueFirst(path, data)
.setModeForPath(name) .setModeForPath(name)

View file

@ -19,8 +19,15 @@ let Loading = true;
let Element; let Element;
let editor; let editor;
let InfoElement;
const ConfigView = { const ConfigView = {
beforeClose: () => {
document.body.removeChild(InfoElement);
},
afterShow: () => { afterShow: () => {
document.body.appendChild(InfoElement);
editor editor
.moveCursorTo(0, 0) .moveCursorTo(0, 0)
.focus(); .focus();
@ -28,6 +35,7 @@ const ConfigView = {
}; };
module.exports.init = async () => { module.exports.init = async () => {
createInfoElement();
const element = createElement(); const element = createElement();
await CloudCmd.View(); await CloudCmd.View();
@ -99,6 +107,22 @@ module.exports.hide = () => {
CloudCmd.View.hide(); CloudCmd.View.hide();
}; };
module.exports.setInfo = (info) => {
InfoElement.textContent = info;
return this;
};
function createInfoElement() {
InfoElement = load({
name: 'div',
style:
'top: 0;' +
'left: 20px;' +
'position: fixed;',
inner: '',
});
}
const loadFiles = promisify((element, callback) => { const loadFiles = promisify((element, callback) => {
const socketPath = CloudCmd.PREFIX; const socketPath = CloudCmd.PREFIX;
const prefix = socketPath + '/' + EditorName; const prefix = socketPath + '/' + EditorName;