From 85e46bb94b285b80cc55b2aa65b4d3506af77979 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sat, 8 Sep 2018 23:07:49 +0300 Subject: [PATCH] feature(edit) add info text --- client/modules/edit-file.js | 1 + client/modules/edit.js | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/client/modules/edit-file.js b/client/modules/edit-file.js index 01dc124e..97f49441 100644 --- a/client/modules/edit-file.js +++ b/client/modules/edit-file.js @@ -74,6 +74,7 @@ module.exports.show = (options) => { setMsgChanged(name); CloudCmd.Edit + .setInfo(name) .getEditor() .setValueFirst(path, data) .setModeForPath(name) diff --git a/client/modules/edit.js b/client/modules/edit.js index 95c57fb9..d1abaa7d 100644 --- a/client/modules/edit.js +++ b/client/modules/edit.js @@ -19,8 +19,15 @@ let Loading = true; let Element; let editor; +let InfoElement; + const ConfigView = { + beforeClose: () => { + document.body.removeChild(InfoElement); + }, afterShow: () => { + document.body.appendChild(InfoElement); + editor .moveCursorTo(0, 0) .focus(); @@ -28,6 +35,7 @@ const ConfigView = { }; module.exports.init = async () => { + createInfoElement(); const element = createElement(); await CloudCmd.View(); @@ -99,6 +107,22 @@ module.exports.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 socketPath = CloudCmd.PREFIX; const prefix = socketPath + '/' + EditorName;