X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/f499ee9347f539c36f3846fdc41020f2320bae77..58e0903a3f0e1e105a11638b18b588e9eb6a8b9e:/apps/toolbar/fixtures/initial_data.yaml diff --git a/apps/toolbar/fixtures/initial_data.yaml b/apps/toolbar/fixtures/initial_data.yaml new file mode 100644 index 00000000..723732d2 --- /dev/null +++ b/apps/toolbar/fixtures/initial_data.yaml @@ -0,0 +1,895 @@ +- fields: {name: Akapity, position: 0, slug: akapity} + model: toolbar.buttongroup + pk: 14 +- fields: {name: Autokorekta, position: 0, slug: autokorekta} + model: toolbar.buttongroup + pk: 2 +- fields: {name: Bloki, position: 0, slug: bloki} + model: toolbar.buttongroup + pk: 21 +- fields: {name: 'Dramat ', position: 0, slug: dramat} + model: toolbar.buttongroup + pk: 12 +- fields: {name: "Elementy pocz\u0105tkowe", position: 0, slug: elementy-poczatkowe} + model: toolbar.buttongroup + pk: 13 +- fields: {name: Mastery, position: 0, slug: mastery} + model: toolbar.buttongroup + pk: 11 +- fields: {name: "Nag\u0142\xF3wki", position: 0, slug: naglowki} + model: toolbar.buttongroup + pk: 1 +- fields: {name: "Pocz\u0105tek dramatu", position: 0, slug: poczatek-dramatu} + model: toolbar.buttongroup + pk: 22 +- fields: {name: Polecenia, position: 0, slug: polecenia} + model: toolbar.buttongroup + pk: 27 +- fields: {name: Przypisy, position: 0, slug: przypisy} + model: toolbar.buttongroup + pk: 26 +- fields: {name: Separatory, position: 0, slug: separatory} + model: toolbar.buttongroup + pk: 16 +- fields: {name: Style znakowe, position: 0, slug: style-znakowe} + model: toolbar.buttongroup + pk: 15 +- fields: {name: Wersy, position: 0, slug: wersy} + model: toolbar.buttongroup + pk: 17 +- fields: + group: [14, 12] + accesskey: a + label: akapit + link: '' + params: '{"tag": "akap"}' + scriptlet: insert_tag + slug: akapit + tooltip: wstawia akapit + model: toolbar.button + pk: 39 +- fields: + group: [14] + accesskey: '' + label: akapit cd. + link: '' + params: '{"tag": "akap_cd"}' + scriptlet: insert_tag + slug: akapit-cd + tooltip: "ci\u0105g dalszy akapitu po wewn\u0105trzakapitowym wtr\u0105ceniu" + model: toolbar.button + pk: 40 +- fields: + group: [14] + accesskey: d + label: akapit dialogowy + link: '' + params: '{"tag": "akap_dialog"}' + scriptlet: insert_tag + slug: akapit-dialogowy + tooltip: wstawia akapit dialogowy + model: toolbar.button + pk: 41 +- fields: + group: [1] + accesskey: '' + label: akt + link: '' + params: '{"tag": "akt"}' + scriptlet: insert_tag + slug: akt + tooltip: '' + model: toolbar.button + pk: 14 +- fields: + group: [13] + accesskey: '' + label: autor + link: '' + params: '{"tag": "autor_utworu"}' + scriptlet: insert_tag + slug: autor + tooltip: '' + model: toolbar.button + pk: 32 +- fields: + group: [2] + accesskey: '' + label: Podstawowa + link: '' + params: '[["fulltextregexp", {"exprs": [["\ufeff", ""], ["$[\\s]*\\d+[\\s]*^", + ""], ["-\\s*^", ""], ["\\,\\.\\.|\\.\\,\\.|\\.\\.\\,", "..."]]}], ["lineregexp", + {"exprs": [["^\\s+|\\s+$", ""], ["\\s+", " "], ["(,,)\\s+|\\s+(\")", "$1"], + ["(\\d)[\u2014-](\\d)", "$1--$2"], ["[\u2014]", "---"], ["<(/?)P([aert])", + "<$1p$2"], ["([^\\.])(\\s*)
\u2193" + link: '' + params: '[]' + scriptlet: lowercase + slug: tolowercase + tooltip: "Zamie\u0144 wielkie litery na ma\u0142e" + model: toolbar.button + pk: 76 +- fields: + group: [15] + accesskey: '' + label: "tytu\u0142 dzie\u0142a" + link: '' + params: '{"tag": "tytul_dziela"}' + scriptlet: insert_tag + slug: tytul-dziela + tooltip: '' + model: toolbar.button + pk: 92 +- fields: + group: [15] + accesskey: '' + label: "tytu\u0142 dzie\u0142a typ 1" + link: '' + params: '{"tag": "tytul_dziela", "attrs": {"typ": "1"}}' + scriptlet: insert_tag + slug: tytul-dziela-typ + tooltip: "tytu\u0142 dzie\u0142a w cytowanym tytule dzie\u0142a" + model: toolbar.button + pk: 45 +- fields: + group: [27] + accesskey: '' + label: uwaga + link: '' + params: '{"tag": "uwaga"}' + scriptlet: insert_tag + slug: uwaga + tooltip: 'uwagi redaktorsko-korektorskie ' + model: toolbar.button + pk: 51 +- fields: + group: [14, 17] + accesskey: '' + label: wers akap. + link: '' + params: '{"tag": "wers_akap"}' + scriptlet: insert_tag + slug: wers-akap + tooltip: "wers rozpoczynaj\u0105cy si\u0119 wci\u0119ciem akapitowym" + model: toolbar.button + pk: 83 +- fields: + group: [12, 17] + accesskey: '' + label: wers cd. + link: '' + params: '{"tag": "wers_cd"}' + scriptlet: insert_tag + slug: wers-cd + tooltip: "cz\u0119\u015B\u0107 wersu przeniesiona do innego wiersza" + model: toolbar.button + pk: 85 +- fields: + group: [12, 17] + accesskey: w + label: "wers mocno wci\u0119ty" + link: '' + params: '{"tag": "wers_wciety", "attrs": {"typ": ""}}' + scriptlet: insert_tag + slug: wers-mocno-wciety + tooltip: "argumenty wersu wci\u0119tego: od 2 do 6" + model: toolbar.button + pk: 84 +- fields: + group: [12, 17] + accesskey: q + label: "wers wci\u0119ty" + link: '' + params: '{"tag": "wers_wciety", "attrs": {"typ": "1"}}' + scriptlet: insert_tag + slug: wers-wciety + tooltip: "wstawia wers wci\u0119ty" + model: toolbar.button + pk: 91 +- fields: + group: [15] + accesskey: '' + label: www + link: '' + params: '{"tag": "www"}' + scriptlet: insert_tag + slug: www + tooltip: '' + model: toolbar.button + pk: 48 +- fields: + group: [15] + accesskey: '' + label: "wyr\xF3\u017Cnienie" + link: '' + params: '{"tag": "wyroznienie"}' + scriptlet: insert_tag + slug: wyroznienie + tooltip: "wyr\xF3\u017Cnienie autorskie" + model: toolbar.button + pk: 44 +- fields: + group: [11] + accesskey: '' + label: wywiad + link: '' + params: '{"tag": "wywiad"}' + scriptlet: insert_tag + slug: wywiad + tooltip: '' + model: toolbar.button + pk: 25 +- fields: + group: [21] + accesskey: '' + label: "wywiad odpowied\u017A" + link: '' + params: '{"tag": "wywiad_odp"}' + scriptlet: insert_tag + slug: wywiad-odpowiedz + tooltip: '' + model: toolbar.button + pk: 73 +- fields: + group: [21] + accesskey: '' + label: wywiad pytanie + link: '' + params: '{"tag": "wywiad_pyt"}' + scriptlet: insert_tag + slug: wywiad-pytanie + tooltip: '' + model: toolbar.button + pk: 72 +- fields: + group: [2] + accesskey: '' + label: "Zamie\u0144 dywiz" + link: '' + params: '{"exprs": [["(\\s)-(\\s)", "$1---$2"], ["^(\\s*)-(\\s)", "$1---$2"], + ["(\\s)-(\\s*)$", "$1---$2"], ["(\\d)[\u2014\u2013\u2010-](\\d)", "$1--$2"], + ["\u2014\u2013\u2010", "---"]]}' + scriptlet: lineregexp + slug: zamien_dywiz + tooltip: "Zamienia '\u2014' na '---', oraz '1\u20142' na '1--2'." + model: toolbar.button + pk: 2 +- fields: + group: [16] + accesskey: '' + label: "zast\u0119pnik wersu" + link: '' + params: '{"tag": "zastepnik_wersu"}' + scriptlet: insert_tag + slug: zastepnik-wersu + tooltip: wykropkowanie wersu + model: toolbar.button + pk: 56 +- fields: {code: "var texteditor = panel.texteditor;\nvar text = texteditor.selection();\n\ + var start_tag = '<'+params.tag;\nfor (var attr in params.attrs) {\n \ + \ start_tag += ' '+attr+'=\"' + params.attrs[attr] + '\"';\n};\nstart_tag\ + \ += '>';\nvar end_tag = ''+params.tag+'>';\n\nif(text.length > 0) {\n\ + // tokenize\nvar output = ''\nvar token = ''\nfor(var index=0; index <\ + \ text.length; index++)\n{\n if (text[index].match(/\\s/)) { // whitespace\n\ + \ token += text[index];\n }\n else { // character\n \ + \ output += token;\n if(output == token) output += start_tag;\n\ + \ token = ''\n output += text[index];\n }\n}\n\nif( output[output.length-1]\ + \ == '\\\\' ) {\n output = output.substr(0, output.length-1) + end_tag\ + \ + '\\\\';\n} else {\n output += end_tag;\n}\noutput += token;\n}\n\ + else {\n output = start_tag + end_tag;\n}\n\ntexteditor.replaceSelection(output);\n\ + \nif (text.length == 0) {\n var pos = texteditor.cursorPosition();\n\ + \ texteditor.selectLines(pos.line, pos.character + params.tag.length\ + \ + 2);\n}\n\npanel.fireEvent('contentChanged');"} + model: toolbar.scriptlet + pk: insert_tag +- fields: {code: "editor.showPopup('generic-info', 'Przetwarzanie zaznaczonego tekstu...',\ + \ '', -1);\n\nvar cm = panel.texteditor;\nvar exprs = $.map(params.exprs,\ + \ function(expr) {\n\n var opts = \"g\";\n\n if(expr.length > 2)\n\ + \n opts = expr[2];\n\n return {rx: new RegExp(expr[0], opts),\ + \ repl: expr[1]};\n\n});\n\n\n\nvar partial = true;\n\nvar text = cm.selection();\n\ + \n\n\nif(!text) {\n\n var cpos = cm.cursorPosition();\n\n cpos.line\ + \ = cm.lineNumber(cpos.line)\n\n cm.selectLines(cm.firstLine(), 0,\ + \ cm.lastLine(), 0);\n\n text = cm.selection();\n\n partial = false;\n\ + \n}\n\n\n\nvar changed = 0;\nvar lines = text.split('\\n');\nvar lines\ + \ = $.map(lines, function(line) { \n var old_line = line;\n $(exprs).each(function()\ + \ { \n var expr = this;\n line = line.replace(expr.rx, expr.repl);\n\ + \ });\n\n if(old_line != line) changed += 1;\n return line;\n\ + });\n\nif(changed > 0) \n{\n cm.replaceSelection( lines.join('\\n')\ + \ );\n panel.fireEvent('contentChanged');\n editor.showPopup('generic-yes',\ + \ 'Zmieniono ' + changed + ' linii.', 1500);\n editor.advancePopupQueue();\n\ + }\nelse {\n editor.showPopup('generic-info', 'Brak zmian w tek\u015B\ + cie', 1500);\n editor.advancePopupQueue();\n}\n\nif(!partial)\n \ + \ cm.selectLines( cm.nthLine(cpos.line), cpos.character )"} + model: toolbar.scriptlet + pk: lineregexp +- fields: {code: "editor.showPopup('generic-info', 'Przetwarzanie zaznaczonego tekstu...',\ + \ '', -1);\n$.log(editor, panel, params);\nvar cm = panel.texteditor;\n\ + var exprs = $.map(params.exprs, function(expr) {\n var opts = \"mg\"\ + ;\n if(expr.length > 2)\n opts = expr[2];\n\n return {rx:\ + \ new RegExp(expr[0], opts), repl: expr[1]};\n});\n\nvar partial = true;\n\ + var text = cm.selection();\n\nif(!text) {\n var cpos = cm.cursorPosition();\n\ + \ cpos.line = cm.lineNumber(cpos.line)\n cm.selectLines(cm.firstLine(),\ + \ 0, cm.lastLine(), 0);\n\n text = cm.selection();\n partial = false;\n\ + }\n\nvar original = text;\n$(exprs).each(function() { \n text = text.replace(this.rx,\ + \ this.repl);\n});\n\nif( original != text) \n{ \n cm.replaceSelection(text);\n\ + \ panel.fireEvent('contentChanged');\n editor.showPopup('generic-yes',\ + \ 'Zmieniono tekst' );\n editor.advancePopupQueue();\n}\nelse {\n \ + \ editor.showPopup('generic-info', 'Brak zmian w tek\u015Bcie.');\n\ + \ editor.advancePopupQueue();\n}\n\nif(!partial) {\n cm.selectLines(\ + \ cm.nthLine(cpos.line), cpos.character );\n}"} + model: toolbar.scriptlet + pk: fulltextregexp +- fields: {code: "$(params).each(function() {\n $.log(this[0], this[1]);\n \ + \ editor.callScriptlet(this[0], panel, this[1]);\n\n});"} + model: toolbar.scriptlet + pk: macro +- 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;\ + \ /* was lowercase */\r\nelse if(ucase != text) repl = lcase; /* neither\ + \ lower- or upper-case */\r\nelse { /* upper case -> title-case */\r\n\ + \ var words = $(lcase.split(/\\s/)).map(function() { \r\n if(this.length\ + \ > 0) { return this[0].toUpperCase() + this.slice(1); } else { return\ + \ ''}\r\n }); \r\n repl = words.join(' ');\r\n} \r\n\r\nif(repl !=\ + \ text) {\r\n cm.replaceSelection(repl);\r\n panel.fireEvent('contentChanged');\r\ + \n};"} + model: toolbar.scriptlet + pk: lowercase +- fields: {code: "var texteditor = panel.texteditor;\r\nvar text = texteditor.selection();\r\ + \n\r\nif(text) {\r\n var verses = text.split('\\n');\r\n var text =\ + \ ''; var buf = ''; var ebuf = '';\r\n var first = true;\r\n\r\n for(var\ + \ i=0; i < verses.length; i++) {\r\n verse = verses[i].replace(/^\\\ + s+/, \"\").replace(/\\s+$/, \"\"); \r\n if(verse) {\r\n text\ + \ += (buf ? buf + '/\\n' : '') + ebuf;\r\n buf = (first ? '