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