From: Radek Czajka Date: Tue, 18 Oct 2011 09:44:33 +0000 (+0200) Subject: trimming buttons on toolbar X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/d7ef322bd562485405be95d8812d4ad79ac458fb trimming buttons on toolbar --- diff --git a/apps/toolbar/fixtures/initial_toolbar.yaml b/apps/toolbar/fixtures/initial_toolbar.yaml index 45a1c7de..c2fb84d5 100644 --- a/apps/toolbar/fixtures/initial_toolbar.yaml +++ b/apps/toolbar/fixtures/initial_toolbar.yaml @@ -209,25 +209,25 @@ - fields: accesskey: '' group: [21] - label: "d\u0142ugi cyt. poet." + label: "d\u0142ugi cytat" link: '' - params: '{"tag": "poezja_cyt"}' + params: '{"tag": "dlugi_cytat"}' scriptlet: insert_tag - slug: dlugi-cyt-poet - tooltip: "d\u0142ugi cytat wierszowany wyr\xF3\u017Cniony sk\u0142adem" + slug: dlugi-cytat + tooltip: "d\u0142ugi cytat wyr\xF3\u017Cniony sk\u0142adem" model: toolbar.button - pk: 67 + pk: 42 - fields: accesskey: '' group: [21] - label: "d\u0142ugi cytat" + label: "d\u0142ugi cyt. poet." link: '' - params: '{"tag": "dlugi_cytat"}' + params: '{"tag": "poezja_cyt"}' scriptlet: insert_tag - slug: dlugi-cytat - tooltip: "d\u0142ugi cytat wyr\xF3\u017Cniony sk\u0142adem" + slug: dlugi-cyt-poet + tooltip: "d\u0142ugi cytat wierszowany wyr\xF3\u017Cniony sk\u0142adem" model: toolbar.button - pk: 42 + pk: 67 - fields: accesskey: '' group: [11] @@ -418,17 +418,6 @@ tooltip: "Zamienia cudzys\u0142owy podw\xF3jne na francuskie" model: toolbar.button pk: 2 -- fields: - accesskey: '' - group: [2] - label: ",,\u2026\" na \xBB\u2026\xAB" - link: '' - params: '{"exprs": [[",,", "\u00bb"], ["\"", "\u00ab"]]}' - scriptlet: fulltextregexp - slug: na-niemieckie - tooltip: "Zamienia cudzys\u0142owy podw\xF3jne na niemieckie" - model: toolbar.button - pk: 3 - fields: accesskey: '' group: [28] @@ -464,6 +453,17 @@ tooltip: "nag\u0142\xF3wek listy os\xF3b" model: toolbar.button pk: 94 +- fields: + accesskey: '' + group: [2] + label: ",,\u2026\" na \xBB\u2026\xAB" + link: '' + params: '{"exprs": [[",,", "\u00bb"], ["\"", "\u00ab"]]}' + scriptlet: fulltextregexp + slug: na-niemieckie + tooltip: "Zamienia cudzys\u0142owy podw\xF3jne na niemieckie" + model: toolbar.button + pk: 3 - fields: accesskey: '' group: [13] @@ -674,7 +674,7 @@ model: toolbar.button pk: 53 - fields: - accesskey: '' + accesskey: e group: [15] label: "s\u0142owo obce" link: '' @@ -752,6 +752,28 @@ pk: 76 - fields: accesskey: '' + group: [28] + label: trim begin + link: '' + params: '{"text": "\n\n"}' + scriptlet: insert_text + slug: trim-begin + tooltip: "Wstawia pocz\u0105tkowy znacznik ci\u0119cia cz\u0119\u015Bci" + model: toolbar.button + pk: 106 +- fields: + accesskey: '' + group: [28] + label: trim end + link: '' + params: '{"text": "\n\n"}' + scriptlet: insert_text + slug: trim-end + tooltip: "Wstawia ko\u0144cowy znacznik ci\u0119cia cz\u0119\u015Bci" + model: toolbar.button + pk: 107 +- fields: + accesskey: r group: [15] label: "tytu\u0142 dzie\u0142a" link: '' @@ -850,7 +872,7 @@ model: toolbar.button pk: 48 - fields: - accesskey: '' + accesskey: f group: [12, 15] label: "wyr\xF3\u017Cnienie" link: '' @@ -965,6 +987,9 @@ \ cm.nthLine(cpos.line), cpos.character );\n}"} model: toolbar.scriptlet pk: fulltextregexp +- fields: {code: '-'} + model: toolbar.scriptlet + pk: insert_text - fields: {code: "var cm = panel.texteditor;\r\nvar text = cm.selection();\r\n\r\ \nif(!text) return;\r\nvar repl = '';\r\nvar lcase = text.toLowerCase();\r\ \nvar ucase = text.toUpperCase();\r\n\r\nif(lcase == text) repl = ucase;\ @@ -994,4 +1019,3 @@ - fields: {code: '-'} model: toolbar.scriptlet pk: slugify - diff --git a/redakcja/static/js/button_scripts.js b/redakcja/static/js/button_scripts.js index ef2b794d..6e729157 100644 --- a/redakcja/static/js/button_scripts.js +++ b/redakcja/static/js/button_scripts.js @@ -48,6 +48,11 @@ function ScriptletCenter() { this.scriptlets = {}; + this.scriptlets['insert_text'] = function(context, params, text, move_forward, move_up, done) + { + done(params.text, move_forward, move_up); + }.bind(this); + this.scriptlets['insert_tag'] = function(context, params, text, move_forward, move_up, done) { var padding_top = ''; @@ -355,4 +360,4 @@ var scriptletCenter; $(function() { scriptletCenter = new ScriptletCenter(); -}); \ No newline at end of file +});