X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/bec14a088e45d21ac12f9c5e852dd0b7e559d680..22e3b34bf8d927591ec441d8a1af0002d9ebbbb3:/src/editor/plugins/core/lists.js diff --git a/src/editor/plugins/core/lists.js b/src/editor/plugins/core/lists.js index 911a1f2..0c017f8 100644 --- a/src/editor/plugins/core/lists.js +++ b/src/editor/plugins/core/lists.js @@ -41,7 +41,12 @@ var toggleListAction = function(type) { listParams.node1 = boundries.node1; listParams.node2 = boundries.node2; boundries.node1.document.transaction(function() { - boundries.node1.document.createList(listParams); + var list = boundries.node1.document.createList(listParams), + item1 = list.object.getItem(0), + text = item1 ? item1.contents()[0] : undefined, // + doc = boundries.node1.document; + + return doc.createFragment(doc.CaretFragment, {node: text, offset:0}); }, { metadata: { description: action.getState().description @@ -96,6 +101,7 @@ var toggleListAction = function(type) { return false; }; + var label = type === 'Bullet' ? gettext('bull. list') : gettext('num. list'); return { name: 'toggle' + type + 'List', @@ -104,7 +110,7 @@ var toggleListAction = function(type) { fragment: {type: 'context', name: 'fragment'} }, stateDefaults: { - label: type === 'Bullet' ? gettext('bull. list') : gettext('num. list') + label: label }, getState: function(params) { if(!params.fragment || !params.fragment.isValid()) { @@ -116,7 +122,7 @@ var toggleListAction = function(type) { if((list.getClass() === 'list' && type === 'Enum') || (list.getClass() === 'list.enum' && type === 'Bullet')) { return { allowed: true, - description: interpolate(gettext('Change list type to %s'), [type]), + description: interpolate(gettext('Change list type to %s'), [label]), execute: execute.changeType }; }