From: Aleksander Łukasz Date: Wed, 7 Aug 2013 07:48:50 +0000 (+0200) Subject: Custom names for wlxml tags/classes - first approach X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/39f08569a5e595a7622b8bb4ab27dbfcab502c62 Custom names for wlxml tags/classes - first approach --- diff --git a/modules/documentToolbar/documentToolbar.js b/modules/documentToolbar/documentToolbar.js index e4d5039..e3bc1eb 100644 --- a/modules/documentToolbar/documentToolbar.js +++ b/modules/documentToolbar/documentToolbar.js @@ -1,11 +1,11 @@ -define(['libs/jquery-1.9.1.min', 'libs/underscore-min', 'libs/text!./template.html'], function($, _, template) { +define(['libs/jquery-1.9.1.min', 'libs/underscore-min', 'utils/wlxml', 'libs/text!./template.html'], function($, _, wlxmlUtils, template) { 'use strict'; return function(sandbox) { var view = { - node: $(_.template(template)()), + node: $(_.template(template)({tagNames: wlxmlUtils.wlxmlTagNames, classNames: wlxmlUtils.wlxmlClassNames})), setup: function() { var view = this; diff --git a/modules/documentToolbar/template.html b/modules/documentToolbar/template.html index e521f25..86357bc 100644 --- a/modules/documentToolbar/template.html +++ b/modules/documentToolbar/template.html @@ -7,13 +7,13 @@ diff --git a/modules/nodePane/nodePane.js b/modules/nodePane/nodePane.js index 3a4a0ef..b723e68 100644 --- a/modules/nodePane/nodePane.js +++ b/modules/nodePane/nodePane.js @@ -2,14 +2,15 @@ define([ 'libs/text!./template.html', 'libs/jquery-1.9.1.min', 'libs/underscore-min', -'modules/nodePane/metaWidget/metaWidget' -], function(templateSrc, $, _, metaWidget) { +'modules/nodePane/metaWidget/metaWidget', +'utils/wlxml' +], function(templateSrc, $, _, metaWidget, wlxmlUtils) { 'use strict'; return function(sandbox) { - var view = $(_.template(templateSrc)()); + var view = $(_.template(templateSrc)({tagNames: wlxmlUtils.wlxmlTagNames, classNames: wlxmlUtils.wlxmlClassNames})); view.on('change', 'select', function(e) { var target = $(e.target); diff --git a/modules/nodePane/template.html b/modules/nodePane/template.html index a40e711..b9a1254 100644 --- a/modules/nodePane/template.html +++ b/modules/nodePane/template.html @@ -6,16 +6,16 @@
diff --git a/utils/wlxml.js b/utils/wlxml.js new file mode 100644 index 0000000..5f1b84d --- /dev/null +++ b/utils/wlxml.js @@ -0,0 +1,36 @@ +define([ + +], function() { + +'use strict'; + + + +return { + wlxmlTagNames: { + '': '', + section: 'sekcja', + header: 'nagłówek', + div: 'blok', + span: 'tekst', + aside: 'poboczny' + }, + wlxmlClassNames: { + '': '', + author: 'autor', + title: 'tytuł', + cite: 'cytat', + 'cite.code': 'cytat.kod', + 'cite.code.xml': 'cytat.kod.xml', + 'list.items': 'lista', + 'list.items.enum': 'lista.numerowana', + item: 'element', + uri: 'uri', + p: 'paragraf', + footnote: 'przypis', + todo: 'todo', + emp: 'wyróżnienie' + } +}; + +}); \ No newline at end of file