X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/300def05b91611b2382df4837c0041d231c8b432..dec7209ba6551afa5b885e892bff4f9ff34ef58b:/fixtures/przyciski.yaml diff --git a/fixtures/przyciski.yaml b/fixtures/przyciski.yaml new file mode 100644 index 00000000..0edc497f --- /dev/null +++ b/fixtures/przyciski.yaml @@ -0,0 +1,73 @@ +- fields: {name: Autokorekta, position: 0, slug: autokorekta} + model: toolbar.buttongroup + pk: 2 +- fields: {name: Formatowanie, position: 0, slug: formatowanie} + model: toolbar.buttongroup + pk: 1 +- fields: + group: [2] + key: '' + label: Novelpages + params: "({exprs: [\r\n [\"\\\\,\\\\.\\\\.|\\\\.\\\\,\\\\.|\\\\.\\\\.\\\\\ + ,\", \"...\"],\r\n [\"\u201E\", \",,\"] /* DOUBLE LOW-9 QUOTATION MARK\ + \ */\r\n]})\r\n " + scriptlet: lineregexp + slug: novelpages + tooltip: "Wykonuj\u0119 operacj\u0119 z novel-pages." + model: toolbar.button + pk: 4 +- fields: + group: [2] + key: '' + label: "Usu\u0144 spacj\u0119" + params: '({exprs: [ ["^\\s+|\\s+$", ""], ["\\s+", " "] ]})' + scriptlet: lineregexp + slug: strip_whitespace + tooltip: "Usuwa zb\u0119dne spacj\u0119 z dokumentu." + model: toolbar.button + pk: 3 +- fields: + group: [1] + key: w + label: Wers + params: '({tag: ''wers''})' + scriptlet: insert_tag + slug: insert_verse + tooltip: Otacza zaznaczony tekst tagiem 'wers'. + model: toolbar.button + pk: 1 +- fields: + group: [2] + key: '' + label: "Zamie\u0144 dywiz" + params: "({exprs:[ [\"\u2014\",\"---\"] ]})" + scriptlet: lineregexp + slug: zamien_dywiz + tooltip: "Zamienia '\u2014' na '---'." + model: toolbar.button + pk: 2 +- fields: {code: "$.log(editor, panel, params);\r\n\r\nvar texteditor = panel.texteditor;\r\ + \nvar text = texteditor.selection();\r\ntexteditor.replaceSelection('<'\ + \ + params.tag + '>' + text + '');\r\nif (text.length\ + \ == 0) \r\n{\r\n var pos = texteditor.cursorPosition();\r\n texteditor.selectLines(pos.line,\ + \ pos.character + params.tag.length + 2);\r\n}\r\n\r\npanel.fireEvent('contentChanged');"} + model: toolbar.scriptlet + pk: insert_tag +- fields: {code: "// params: {exprs: list of {expr: \"\", repl: \"\" [, opts: \"\ + g\"]}}\r\nvar cm = panel.texteditor;\r\n\r\nvar exprs = $.map(params.exprs,\ + \ function(expr) {\r\n var opts = \"g\";\r\n if(expr.length > 2)\r\ + \n opts = expr[2];\r\n return {rx: new RegExp(expr[0], opts),\ + \ repl: expr[1]};\r\n});\r\n\r\nvar selection = cm.selection();\r\n\r\n\ + if(selection) \r\n{\r\n var lines = selection.split('\\n');\r\n \ + \ lines = $.map(lines, function(line) { \r\n for each(var expr\ + \ in exprs) {\r\n line = line.replace(expr.rx, expr.repl);\r\ + \n };\r\n return line;\r\n });\r\n cm.replaceSelection(\ + \ lines.join('\\n') );\r\n}\r\nelse {\r\n var line = cm.firstLine();\r\ + \n do {\r\n var content = cm.lineContent(line);\r\n \r\n\ + \ for each(var expr in exprs) {\r\n content = content.replace(expr.rx,\ + \ expr.repl);\r\n };\r\n cm.setLineContent(line, content);\r\ + \n line = cm.nextLine(line);\r\n } while( !(line === false)\ + \ );\r\n}"} + model: toolbar.scriptlet + pk: lineregexp +