diff --git a/CHANGELOG.md b/CHANGELOG.md index e4ef9813..593fc5b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - widgets - **new** (piano) keyboard widget - matrices: fixed `preArgs` option; added `split` option (default to `false`), *it changes the default osc messages formatting for these widgets* + - icons in labels are inserted using the `^` prefix ## 0.11.6 diff --git a/resources/docs/user-guide/widgets-generics.md b/resources/docs/user-guide/widgets-generics.md index 944aabd7..6a2a4839 100644 --- a/resources/docs/user-guide/widgets-generics.md +++ b/resources/docs/user-guide/widgets-generics.md @@ -42,7 +42,7 @@ A widget object is a javascript object. All widgets share a set of generic prope - default: `auto`, which displays `id` - usage: - set to `false` to hide completely - - set to `icon: fontawesome-class` to display an icon from [FontAwesome](http://fontawesome.io/icons/) (replace `fontawesome-class` with the icon's name) + - insert icons from [FontAwesome](http://fontawesome.io/icons/) using the prefix `^` followed by the icon's name : `made with ^heart`, etc #### `top` / `left` - type: `number|percentage` diff --git a/src/browser/js/app/editor/data-workers.js b/src/browser/js/app/editor/data-workers.js index 9ce95ef9..f5a46a50 100644 --- a/src/browser/js/app/editor/data-workers.js +++ b/src/browser/js/app/editor/data-workers.js @@ -9,7 +9,8 @@ var widgets = require('../widgets'), sidepanelCreateToggle = require('../sidepanel').createToggle, editObject = function(a,b){require('./edit-objects').editObject(a,b,true)}, editSession = function(a,b){require('./edit-objects').editSession(a,b,true)}, - purgeStores = require('./purge') + purgeStores = require('./purge'), + {iconify} = require('../utils') var getObjectData = function(obj){ @@ -75,7 +76,7 @@ var updateDom = function(container,data, remote) { container.removeClass('has-tabs') } - $(`[data-tab="#${container.attr('id')}"]`).html(`${data.label}`) + $(`[data-tab="#${container.attr('id')}"]`).html(`${iconify(data.label)}`) if (!remote) editObject(newContainer,data) diff --git a/src/browser/js/app/parser.js b/src/browser/js/app/parser.js index e30d95a2..02f31f39 100644 --- a/src/browser/js/app/parser.js +++ b/src/browser/js/app/parser.js @@ -5,7 +5,7 @@ var widgets = require('./widgets'), widgetOptions = widgets.widgetOptions, createWidget = widgets.createWidget, - icon = require('./utils').icon + {iconify} = require('./utils') var getIterator = function(id,type){ var iterator = MISC.iterators[type] @@ -53,17 +53,18 @@ module.exports.tabs = function(data,parent,main,parentLabel){ hash = hashCode(label), id = 'tab_'+hash+'_'+getIterator('tab'+hash,'tab') - tabData.label = label + tabData.label = iconify(label) + delete tabData.id - navtabs.append(`