X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/dec7209ba6551afa5b885e892bff4f9ff34ef58b..842edee28ab403f3d113d9b41e1a879c0bddc76e:/fixtures/przyciski.yaml?ds=sidebyside diff --git a/fixtures/przyciski.yaml b/fixtures/przyciski.yaml index 0edc497f..a8cef760 100644 --- a/fixtures/przyciski.yaml +++ b/fixtures/przyciski.yaml @@ -1,73 +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 +- 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\n\ + var selection = cm.selection();\r\n\r\nif(selection) \r\n{\r\n var lines\ + \ = selection.split('\\n');\r\n lines = $.map(lines, function(line) { \r\n\ + \ $(exprs).each(function() { \r\n var expr = this;\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 $.log(\"Swapping line: $\" + content +\ + \ \"$\");\r\n \r\n $(exprs).each(function() { var expr = this;\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