editor: add tooltip hint for help popup (#372)
This commit is contained in:
parent
cabc2aa08a
commit
787f59caaa
6 changed files with 11 additions and 8 deletions
|
|
@ -2,7 +2,8 @@ var widgetCategories = require('../widgets/').categories,
|
|||
{updateWidget} = require('./data-workers'),
|
||||
widgetManager = require('../managers/widgets'),
|
||||
{deepCopy} = require('../utils'),
|
||||
{icon, Popup} = require('../ui/utils')
|
||||
{icon, Popup} = require('../ui/utils'),
|
||||
locales = require('../locales')
|
||||
|
||||
module.exports = function editField(editor, widget, propName, defaultValue){
|
||||
|
||||
|
|
@ -11,7 +12,7 @@ module.exports = function editField(editor, widget, propName, defaultValue){
|
|||
error = widget.errors[propName]
|
||||
|
||||
let field = DOM.create(`
|
||||
<div class="input-wrapper ${widget.errors[propName] ? 'error' : ''} ${disabled ? 'disabled' : ''}">
|
||||
<div class="input-wrapper ${widget.errors[propName] ? 'error' : ''} ${disabled ? 'disabled' : ''}" title="${locales('editor_click_for_help')}">
|
||||
<label class="btn ${error ? 'error' : ''}">${propName}</label>
|
||||
</div>
|
||||
`)
|
||||
|
|
@ -24,11 +25,11 @@ module.exports = function editField(editor, widget, propName, defaultValue){
|
|||
|
||||
if (widget.props.type == 'tab' || widget.props.type == 'root') {
|
||||
field.classList.add('disabled')
|
||||
field.appendChild(DOM.create(`<textarea class="input no-keybinding" title="${propName}" rows="1" disabled>${widget.props[propName]}</textarea>`))
|
||||
field.appendChild(DOM.create(`<textarea class="input no-keybinding" name="${propName}" rows="1" disabled>${widget.props[propName]}</textarea>`))
|
||||
return field
|
||||
}
|
||||
|
||||
input = DOM.create(`<select class="input no-keybinding" title="${propName}"/>`)
|
||||
input = DOM.create(`<select class="input no-keybinding"/>`)
|
||||
var innerHTML = ''
|
||||
|
||||
for (let category in widgetCategories) {
|
||||
|
|
@ -50,7 +51,7 @@ module.exports = function editField(editor, widget, propName, defaultValue){
|
|||
var value = typeof widget.props[propName] !== 'string' ?
|
||||
JSON.stringify(widget.props[propName], null, ' ').replace(/\n\s\s\s\s/g, ' ').replace(/\n\s\s(\}|\])/g, ' $1') : widget.props[propName]
|
||||
|
||||
input = DOM.create(`<textarea class="input no-keybinding" title="${propName}" rows="${value.split('\n').length}">${value}</textarea>`)
|
||||
input = DOM.create(`<textarea class="input no-keybinding" name="${propName}" rows="${value.split('\n').length}">${value}</textarea>`)
|
||||
|
||||
DOM.addEventListener(input, ['input', 'focus'], ()=>{
|
||||
input.setAttribute('rows',0)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ var {widgets} = require('../widgets/'),
|
|||
diff = require('deep-diff'),
|
||||
widgetManager = require('../managers/widgets'),
|
||||
{deepCopy} = require('../utils'),
|
||||
locales = require('../locales'),
|
||||
sessionManager
|
||||
|
||||
const HISTORY_SIZE = 50
|
||||
|
|
@ -120,7 +119,7 @@ var Editor = class Editor {
|
|||
this.moveWidget(deltaX, deltaY)
|
||||
})
|
||||
keyboardJS.bind('f2', (e)=>{
|
||||
var input = DOM.get(this.form, 'textarea[title="label"]')[0]
|
||||
var input = DOM.get(this.form, 'textarea[name="label"]')[0]
|
||||
if (input) {
|
||||
var folded = input.closest('.category.folded')
|
||||
if (folded) DOM.dispatchEvent(DOM.get(folded, '.separator'), 'fast-click')
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ module.exports = {
|
|||
editor_addwidget: 'Add widget',
|
||||
editor_addtab: 'Add tab',
|
||||
editor_delete: 'Delete',
|
||||
editor_click_for_help: 'Click on the property name to display help',
|
||||
|
||||
// loadings
|
||||
loading_upload: 'Uploading file...',
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ module.exports = {
|
|||
editor_addwidget: 'Nouveau widget',
|
||||
editor_addtab: 'Nouvel onglet',
|
||||
editor_delete: 'Supprimer',
|
||||
editor_click_for_help: 'Cliquer sur le nom de la propriété pour afficher l\'aide',
|
||||
|
||||
// loadings
|
||||
loading_upload: 'Téléversement...',
|
||||
|
|
|
|||
|
|
@ -7,4 +7,4 @@ var locales = {
|
|||
|
||||
var lang = locales[LANG] ? LANG : 'en'
|
||||
|
||||
module.exports = key=>locales[lang][key] || `<em class="translation-missing">${key}</em>`
|
||||
module.exports = key=>locales[lang][key] || `<em class='translation-missing'>${key}</em>`
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ module.exports = { // @https://github.com/suhr
|
|||
editor_addwidget: 'Добавить виджет',
|
||||
editor_addtab: 'Добавить вкладку',
|
||||
editor_delete: 'Удалить',
|
||||
editor_click_for_help: 'Нажмите на название свойства, чтобы отобразить справку',
|
||||
|
||||
// loadings
|
||||
loading_upload: 'Загрузка файла...',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue