From: Radek Czajka
Date: Wed, 5 Oct 2011 09:38:06 +0000 (+0200)
Subject: move initial_data to a migration
X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/c766b9b0662499d4213726dbdc2fe65fcd913c68?ds=sidebyside
move initial_data to a migration
---
diff --git a/apps/toolbar/fixtures/initial_data.yaml b/apps/toolbar/fixtures/initial_data.yaml
deleted file mode 100644
index 45a1c7de..00000000
--- a/apps/toolbar/fixtures/initial_data.yaml
+++ /dev/null
@@ -1,997 +0,0 @@
-- 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: Autotagowanie, position: 0, slug: autotagowanie}
- model: toolbar.buttongroup
- pk: 28
-- 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: 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: Uwaga, position: 0, slug: uwaga}
- model: toolbar.buttongroup
- pk: 29
-- fields: {name: Wersy, position: 0, slug: wersy}
- model: toolbar.buttongroup
- pk: 17
-- fields:
- accesskey: a
- group: [14, 12]
- label: akapit
- link: ''
- params: '{"padding_top": 1, "padding_bottom": 3, "tag": "akap"}'
- scriptlet: insert_tag
- slug: akapit
- tooltip: wstawia akapit
- model: toolbar.button
- pk: 39
-- fields:
- accesskey: ''
- group: [14]
- label: akapit cd.
- link: ''
- params: '{"padding_top": 1, "padding_bottom": 3, "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:
- accesskey: d
- group: [14]
- label: akapit dialogowy
- link: ''
- params: '{"padding_top": 1, "padding_bottom": 3, "tag": "akap_dialog"}'
- scriptlet: insert_tag
- slug: akapit-dialogowy
- tooltip: wstawia akapit dialogowy
- model: toolbar.button
- pk: 41
-- fields:
- accesskey: ''
- group: [28]
- label: akapity
- link: ''
- params: '{"tag": "akap"}'
- scriptlet: autotag
- slug: akapity
- tooltip: "autotagowanie akapit\xF3w"
- model: toolbar.button
- pk: 97
-- fields:
- accesskey: ''
- group: [1]
- label: akt
- link: ''
- params: '{"padding_top": 1, "padding_bottom": 4, "tag": "naglowek_akt"}'
- scriptlet: insert_tag
- slug: akt
- tooltip: ''
- model: toolbar.button
- pk: 14
-- fields:
- accesskey: ''
- group: [13]
- label: autor
- link: ''
- params: '{"padding_top": 1, "padding_bottom": 2, "tag": "autor_utworu"}'
- scriptlet: insert_tag
- slug: autor
- tooltip: ''
- model: toolbar.button
- pk: 32
-- fields:
- accesskey: ''
- group: [2]
- label: Podstawowa
- link: ''
- params: '[["fulltextregexp", {"exprs": [["\ufeff", ""], ["$[\\s]*\\d+[\\s]*^",
- ""], ["-\\s*^", ""], ["\\,\\.\\.|\\.\\,\\.|\\.\\.\\,", "..."], ["<(/?)P([aert])",
- "<$1p$2"], ["[\u2014\u2013\u2010-]{2,}|[\u2014\u2013\u2010]+", "---"],
- ["(\\s)-([^-])", "$1---$2"], ["([^-])-(\\s)", "$1---$2"], ["(\\d)-+(\\d)",
- "$1--$2"], ["---(\\S)", "--- $1"], ["(\\S)---", "$1 ---"], ["\\s*-+\\s*",
- "--- "]]}], ["lineregexp", {"exprs": [["^\\s+|\\s+$", ""],
- ["\\s+", " "], ["(,,)\\s+", "$1"], ["\\s+(\")", "$1"], ["([^\\.])(\\s*)
AKT$1"],
- ["^SCENA(\\s\\w*)$", "SCENA$1"], ["([A-Z\u0104\u0106\u0118\u0141\u0143\u00d3\u015a\u017b\u0179]{2}[A-Z\u0104\u0106\u0118\u0141\u0143\u00d3\u015a\u017b\u0179\\s]+)$",
- "$1"]]}'
- scriptlet: lineregexp
- slug: nagl-dramatu
- tooltip: "autotagowanie akt\xF3w, scen, nag\u0142\xF3wk\xF3w os\xF3b"
- model: toolbar.button
- pk: 103
-- fields:
- accesskey: ''
- group: [12]
- label: "nag\u0142\xF3wek kwestii"
- link: ''
- params: '{"padding_top": 1, "padding_bottom": 4, "tag": "naglowek_osoba"}'
- scriptlet: insert_tag
- slug: naglowek-kwestii
- tooltip: "nag\u0142\xF3wek kwestii - nazwa osoby"
- model: toolbar.button
- pk: 16
-- fields:
- accesskey: ''
- group: [22]
- label: "nag\u0142\xF3wek listy"
- link: ''
- params: '{"padding_top": 1, "padding_bottom": 2, "tag": "naglowek_listy"}'
- scriptlet: insert_tag
- slug: naglowek-listy
- tooltip: "nag\u0142\xF3wek listy os\xF3b"
- model: toolbar.button
- pk: 94
-- fields:
- accesskey: ''
- group: [13]
- label: nazwa utworu
- link: ''
- params: '{"padding_top": 1, "padding_bottom": 2, "tag": "nazwa_utworu"}'
- scriptlet: insert_tag
- slug: nazwa-utworu
- tooltip: ''
- model: toolbar.button
- pk: 33
-- fields:
- accesskey: ''
- group: [13]
- label: nota
- link: ''
- params: '{"tag": "nota"}'
- scriptlet: insert_tag
- slug: nota
- tooltip: ''
- model: toolbar.button
- pk: 35
-- fields:
- accesskey: ''
- group: [13]
- label: nota red.
- link: ''
- params: '{"padding_top": 1, "padding_bottom": 3, "tag": "nota_red"}'
- scriptlet: insert_tag
- slug: nota-red
- tooltip: nota redakcyjna
- model: toolbar.button
- pk: 104
-- fields:
- accesskey: ''
- group: [11]
- label: opowiadanie
- link: ''
- params: '{"padding_top": 1, "padding_bottom": 4, "tag": "opowiadanie"}'
- scriptlet: insert_tag
- slug: opowiadanie
- tooltip: ''
- model: toolbar.button
- pk: 18
-- fields:
- accesskey: b
- group: [12]
- label: osoba
- link: ''
- params: '{"tag": "osoba"}'
- scriptlet: insert_tag
- slug: osoba
- tooltip: "wstawia nazw\u0119 osoby w didaskaliach"
- model: toolbar.button
- pk: 64
-- fields:
- accesskey: ''
- group: [22]
- label: osoba na liscie
- link: ''
- params: '{"padding_top": 1, "padding_bottom": 1, "tag": "lista_osoba"}'
- scriptlet: insert_tag
- slug: osoba-na-liscie
- tooltip: "nazwa osoby na liscie os\xF3b"
- model: toolbar.button
- pk: 95
-- fields:
- accesskey: ''
- group: [1]
- label: "podrozdzia\u0142"
- link: ''
- params: '{"tag": "naglowek_podrozdzial"}'
- scriptlet: insert_tag
- slug: podrozdzial
- tooltip: ''
- model: toolbar.button
- pk: 12
-- fields:
- accesskey: ''
- group: [1]
- label: "podtytu\u0142"
- link: ''
- params: '{"tag": "podtytul"}'
- scriptlet: insert_tag
- slug: podtytul
- tooltip: ''
- model: toolbar.button
- pk: 34
-- fields:
- accesskey: ''
- group: [11]
- label: "powie\u015B\u0107"
- link: ''
- params: '{"padding_top": 1, "padding_bottom": 4, "tag": "powiesc"}'
- scriptlet: insert_tag
- slug: powiesc
- tooltip: ''
- model: toolbar.button
- pk: 19
-- fields:
- accesskey: ''
- group: []
- label: Wydrukuj
- link: print/xml
- params: '[]'
- scriptlet: insert_tag
- slug: print-xml
- tooltip: ''
- model: toolbar.button
- pk: 86
-- fields:
- accesskey: ''
- group: [26]
- label: przypis autorski
- link: ''
- params: '{"tag": "pa"}'
- scriptlet: insert_tag
- slug: przypis-autorski
- tooltip: ''
- model: toolbar.button
- pk: 68
-- fields:
- accesskey: ''
- group: [26]
- label: przypis edytorski
- link: ''
- params: '{"tag": "pe"}'
- scriptlet: insert_tag
- slug: przypis-edytorski
- tooltip: ''
- model: toolbar.button
- pk: 71
-- fields:
- accesskey: ''
- group: [26]
- label: przypis redaktorski
- link: ''
- params: '{"tag": "pr"}'
- scriptlet: insert_tag
- slug: przypis-redaktorski
- tooltip: ''
- model: toolbar.button
- pk: 70
-- fields:
- accesskey: ''
- group: [26]
- label: "przypis t\u0142umacza"
- link: ''
- params: '{"tag": "pt"}'
- scriptlet: insert_tag
- slug: przypis-tlumacza
- tooltip: ''
- model: toolbar.button
- pk: 69
-- fields:
- accesskey: ''
- group: [1]
- label: "rozdzia\u0142"
- link: ''
- params: '{"padding_top": 1, "padding_bottom": 4, "tag": "naglowek_rozdzial"}'
- scriptlet: insert_tag
- slug: rozdzial
- tooltip: ''
- model: toolbar.button
- pk: 11
-- fields:
- accesskey: ''
- group: [1]
- label: scena
- link: ''
- params: '{"tag": "naglowek_scena"}'
- scriptlet: insert_tag
- slug: scena
- tooltip: ''
- model: toolbar.button
- pk: 15
-- fields:
- accesskey: ''
- group: [16]
- label: asterysk
- link: ''
- params: '{"nocontent": "true", "tag": "sekcja_asterysk"}'
- scriptlet: insert_tag
- slug: sep-asterysk
- tooltip: rozdzielenie partii tekstu asteryskiem
- model: toolbar.button
- pk: 54
-- fields:
- accesskey: ''
- group: [16]
- label: linia
- link: ''
- params: '{"nocontent": "true", "tag": "separator_linia"}'
- scriptlet: insert_tag
- slug: sep-linia
- tooltip: "rozdzielenie partii tekstu pozioma lini\u0105"
- model: toolbar.button
- pk: 55
-- fields:
- accesskey: ''
- group: [16]
- label: "\u015Bwiat\u0142o"
- link: ''
- params: '{"nocontent": "true", "tag": "sekcja_swiatlo"}'
- scriptlet: insert_tag
- slug: sep-swiatlo
- tooltip: "\u015Bwiat\u0142o rozdzielaj\u0105ce sekcje tekstu"
- model: toolbar.button
- pk: 53
-- fields:
- accesskey: ''
- group: [15]
- label: "s\u0142owo obce"
- link: ''
- params: '{"tag": "slowo_obce"}'
- scriptlet: insert_tag
- slug: slowo-obce
- tooltip: "frazy w j\u0119zykach innych ni\u017C polski/definiendum w przypisie"
- model: toolbar.button
- pk: 46
-- fields:
- accesskey: ''
- group: [2]
- label: slug
- link: ''
- params: '[]'
- scriptlet: slugify
- slug: slug
- tooltip: slugifikacja
- model: toolbar.button
- pk: 105
-- fields:
- accesskey: ''
- group: [1]
- label: "\u015Br\xF3dtytu\u0142"
- link: ''
- params: '{"tag": "srodtytul"}'
- scriptlet: insert_tag
- slug: srodtytul
- tooltip: ''
- model: toolbar.button
- pk: 13
-- fields:
- accesskey: s
- group: [12, 17]
- label: strofa
- link: ''
- params: '{"padding_top": 1, "padding_bottom": 3, "tag": "strofa"}'
- scriptlet: insert_stanza
- slug: strofa
- tooltip: "wstawia strof\u0119"
- model: toolbar.button
- pk: 81
-- fields:
- accesskey: ''
- group: [28]
- label: strofy
- link: ''
- params: '{"tag": "strofa"}'
- scriptlet: autotag
- slug: strofy
- tooltip: autotagowanie strof
- model: toolbar.button
- pk: 99
-- fields:
- accesskey: ''
- group: [11]
- label: "tag g\u0142\xF3wny"
- link: ''
- params: '{"tag": "utwor"}'
- scriptlet: insert_tag
- slug: tag-glowny
- tooltip: ''
- model: toolbar.button
- pk: 17
-- fields:
- accesskey: u
- group: [2]
- label: "A\u2193"
- link: ''
- params: '[]'
- scriptlet: lowercase
- slug: tolowercase
- tooltip: "Zamie\u0144 wielkie litery na ma\u0142e"
- model: toolbar.button
- pk: 76
-- fields:
- accesskey: ''
- group: [15]
- label: "tytu\u0142 dzie\u0142a"
- link: ''
- params: '{"tag": "tytul_dziela"}'
- scriptlet: insert_tag
- slug: tytul-dziela
- tooltip: ''
- model: toolbar.button
- pk: 92
-- fields:
- accesskey: ''
- group: [15]
- 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:
- accesskey: ''
- group: [29]
- label: uwaga
- link: ''
- params: '{"tag": "uwaga"}'
- scriptlet: insert_tag
- slug: uwaga
- tooltip: 'uwagi redaktorsko-korektorskie '
- model: toolbar.button
- pk: 51
-- fields:
- accesskey: ''
- group: [14, 17]
- 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:
- accesskey: ''
- group: [12, 17]
- 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:
- accesskey: w
- group: [12, 17]
- 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:
- accesskey: q
- group: [12, 17]
- 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:
- accesskey: ''
- group: [28]
- label: "wersy wci\u0119te"
- link: ''
- params: '{"padding": 1, "tag": "wers_wciety", "split": 1}'
- scriptlet: autotag
- slug: wersy-wciete
- tooltip: "autotagowanie wers\xF3w wci\u0119tych"
- model: toolbar.button
- pk: 100
-- fields:
- accesskey: ''
- group: [15]
- label: www
- link: ''
- params: '{"tag": "www"}'
- scriptlet: insert_tag
- slug: www
- tooltip: ''
- model: toolbar.button
- pk: 48
-- fields:
- accesskey: ''
- group: [12, 15]
- label: "wyr\xF3\u017Cnienie"
- link: ''
- params: '{"tag": "wyroznienie"}'
- scriptlet: insert_tag
- slug: wyroznienie
- tooltip: "wyr\xF3\u017Cnienie autorskie"
- model: toolbar.button
- pk: 44
-- fields:
- accesskey: ''
- group: [11]
- label: wywiad
- link: ''
- params: '{"padding_top": 1, "padding_bottom": 4, "tag": "wywiad"}'
- scriptlet: insert_tag
- slug: wywiad
- tooltip: ''
- model: toolbar.button
- pk: 25
-- fields:
- accesskey: ''
- group: [21]
- label: "wywiad odpowied\u017A"
- link: ''
- params: '{"tag": "wywiad_odp"}'
- scriptlet: insert_tag
- slug: wywiad-odpowiedz
- tooltip: ''
- model: toolbar.button
- pk: 73
-- fields:
- accesskey: ''
- group: [21]
- label: wywiad pytanie
- link: ''
- params: '{"tag": "wywiad_pyt"}'
- scriptlet: insert_tag
- slug: wywiad-pytanie
- tooltip: ''
- model: toolbar.button
- pk: 72
-- fields:
- accesskey: ''
- group: [16]
- 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: "$(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 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: '-'}
- model: toolbar.scriptlet
- pk: autotag
-- 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: "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 ? '\\\
- n' : '') + verses[i];\r\n ebuf = '';\r\n first = false;\r\n\
- \ } else { \r\n ebuf += '\\n' + verses[i];\r\n }\r\n };\r\
- \n text = text + buf + '\\n' + ebuf; \r\n texteditor.replaceSelection(text);\r\
- \n}\r\n\r\nif (!text) {\r\n var pos = texteditor.cursorPosition();\r\
- \n texteditor.selectLines(pos.line, pos.character + 6 + 2);\r\n}\r\n\
- \r\n\r\n\r\n\r\n\r\n\r\n\r\npanel.fireEvent('contentChanged');"}
- model: toolbar.scriptlet
- pk: insert_stanza
-- fields: {code: '-'}
- model: toolbar.scriptlet
- pk: slugify
-
diff --git a/apps/toolbar/fixtures/initial_toolbar.yaml b/apps/toolbar/fixtures/initial_toolbar.yaml
new file mode 100644
index 00000000..45a1c7de
--- /dev/null
+++ b/apps/toolbar/fixtures/initial_toolbar.yaml
@@ -0,0 +1,997 @@
+- 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: Autotagowanie, position: 0, slug: autotagowanie}
+ model: toolbar.buttongroup
+ pk: 28
+- 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: 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: Uwaga, position: 0, slug: uwaga}
+ model: toolbar.buttongroup
+ pk: 29
+- fields: {name: Wersy, position: 0, slug: wersy}
+ model: toolbar.buttongroup
+ pk: 17
+- fields:
+ accesskey: a
+ group: [14, 12]
+ label: akapit
+ link: ''
+ params: '{"padding_top": 1, "padding_bottom": 3, "tag": "akap"}'
+ scriptlet: insert_tag
+ slug: akapit
+ tooltip: wstawia akapit
+ model: toolbar.button
+ pk: 39
+- fields:
+ accesskey: ''
+ group: [14]
+ label: akapit cd.
+ link: ''
+ params: '{"padding_top": 1, "padding_bottom": 3, "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:
+ accesskey: d
+ group: [14]
+ label: akapit dialogowy
+ link: ''
+ params: '{"padding_top": 1, "padding_bottom": 3, "tag": "akap_dialog"}'
+ scriptlet: insert_tag
+ slug: akapit-dialogowy
+ tooltip: wstawia akapit dialogowy
+ model: toolbar.button
+ pk: 41
+- fields:
+ accesskey: ''
+ group: [28]
+ label: akapity
+ link: ''
+ params: '{"tag": "akap"}'
+ scriptlet: autotag
+ slug: akapity
+ tooltip: "autotagowanie akapit\xF3w"
+ model: toolbar.button
+ pk: 97
+- fields:
+ accesskey: ''
+ group: [1]
+ label: akt
+ link: ''
+ params: '{"padding_top": 1, "padding_bottom": 4, "tag": "naglowek_akt"}'
+ scriptlet: insert_tag
+ slug: akt
+ tooltip: ''
+ model: toolbar.button
+ pk: 14
+- fields:
+ accesskey: ''
+ group: [13]
+ label: autor
+ link: ''
+ params: '{"padding_top": 1, "padding_bottom": 2, "tag": "autor_utworu"}'
+ scriptlet: insert_tag
+ slug: autor
+ tooltip: ''
+ model: toolbar.button
+ pk: 32
+- fields:
+ accesskey: ''
+ group: [2]
+ label: Podstawowa
+ link: ''
+ params: '[["fulltextregexp", {"exprs": [["\ufeff", ""], ["$[\\s]*\\d+[\\s]*^",
+ ""], ["-\\s*^", ""], ["\\,\\.\\.|\\.\\,\\.|\\.\\.\\,", "..."], ["<(/?)P([aert])",
+ "<$1p$2"], ["[\u2014\u2013\u2010-]{2,}|[\u2014\u2013\u2010]+", "---"],
+ ["(\\s)-([^-])", "$1---$2"], ["([^-])-(\\s)", "$1---$2"], ["(\\d)-+(\\d)",
+ "$1--$2"], ["---(\\S)", "--- $1"], ["(\\S)---", "$1 ---"], ["\\s*-+\\s*",
+ "--- "]]}], ["lineregexp", {"exprs": [["^\\s+|\\s+$", ""],
+ ["\\s+", " "], ["(,,)\\s+", "$1"], ["\\s+(\")", "$1"], ["([^\\.])(\\s*)AKT$1"],
+ ["^SCENA(\\s\\w*)$", "SCENA$1"], ["([A-Z\u0104\u0106\u0118\u0141\u0143\u00d3\u015a\u017b\u0179]{2}[A-Z\u0104\u0106\u0118\u0141\u0143\u00d3\u015a\u017b\u0179\\s]+)$",
+ "$1"]]}'
+ scriptlet: lineregexp
+ slug: nagl-dramatu
+ tooltip: "autotagowanie akt\xF3w, scen, nag\u0142\xF3wk\xF3w os\xF3b"
+ model: toolbar.button
+ pk: 103
+- fields:
+ accesskey: ''
+ group: [12]
+ label: "nag\u0142\xF3wek kwestii"
+ link: ''
+ params: '{"padding_top": 1, "padding_bottom": 4, "tag": "naglowek_osoba"}'
+ scriptlet: insert_tag
+ slug: naglowek-kwestii
+ tooltip: "nag\u0142\xF3wek kwestii - nazwa osoby"
+ model: toolbar.button
+ pk: 16
+- fields:
+ accesskey: ''
+ group: [22]
+ label: "nag\u0142\xF3wek listy"
+ link: ''
+ params: '{"padding_top": 1, "padding_bottom": 2, "tag": "naglowek_listy"}'
+ scriptlet: insert_tag
+ slug: naglowek-listy
+ tooltip: "nag\u0142\xF3wek listy os\xF3b"
+ model: toolbar.button
+ pk: 94
+- fields:
+ accesskey: ''
+ group: [13]
+ label: nazwa utworu
+ link: ''
+ params: '{"padding_top": 1, "padding_bottom": 2, "tag": "nazwa_utworu"}'
+ scriptlet: insert_tag
+ slug: nazwa-utworu
+ tooltip: ''
+ model: toolbar.button
+ pk: 33
+- fields:
+ accesskey: ''
+ group: [13]
+ label: nota
+ link: ''
+ params: '{"tag": "nota"}'
+ scriptlet: insert_tag
+ slug: nota
+ tooltip: ''
+ model: toolbar.button
+ pk: 35
+- fields:
+ accesskey: ''
+ group: [13]
+ label: nota red.
+ link: ''
+ params: '{"padding_top": 1, "padding_bottom": 3, "tag": "nota_red"}'
+ scriptlet: insert_tag
+ slug: nota-red
+ tooltip: nota redakcyjna
+ model: toolbar.button
+ pk: 104
+- fields:
+ accesskey: ''
+ group: [11]
+ label: opowiadanie
+ link: ''
+ params: '{"padding_top": 1, "padding_bottom": 4, "tag": "opowiadanie"}'
+ scriptlet: insert_tag
+ slug: opowiadanie
+ tooltip: ''
+ model: toolbar.button
+ pk: 18
+- fields:
+ accesskey: b
+ group: [12]
+ label: osoba
+ link: ''
+ params: '{"tag": "osoba"}'
+ scriptlet: insert_tag
+ slug: osoba
+ tooltip: "wstawia nazw\u0119 osoby w didaskaliach"
+ model: toolbar.button
+ pk: 64
+- fields:
+ accesskey: ''
+ group: [22]
+ label: osoba na liscie
+ link: ''
+ params: '{"padding_top": 1, "padding_bottom": 1, "tag": "lista_osoba"}'
+ scriptlet: insert_tag
+ slug: osoba-na-liscie
+ tooltip: "nazwa osoby na liscie os\xF3b"
+ model: toolbar.button
+ pk: 95
+- fields:
+ accesskey: ''
+ group: [1]
+ label: "podrozdzia\u0142"
+ link: ''
+ params: '{"tag": "naglowek_podrozdzial"}'
+ scriptlet: insert_tag
+ slug: podrozdzial
+ tooltip: ''
+ model: toolbar.button
+ pk: 12
+- fields:
+ accesskey: ''
+ group: [1]
+ label: "podtytu\u0142"
+ link: ''
+ params: '{"tag": "podtytul"}'
+ scriptlet: insert_tag
+ slug: podtytul
+ tooltip: ''
+ model: toolbar.button
+ pk: 34
+- fields:
+ accesskey: ''
+ group: [11]
+ label: "powie\u015B\u0107"
+ link: ''
+ params: '{"padding_top": 1, "padding_bottom": 4, "tag": "powiesc"}'
+ scriptlet: insert_tag
+ slug: powiesc
+ tooltip: ''
+ model: toolbar.button
+ pk: 19
+- fields:
+ accesskey: ''
+ group: []
+ label: Wydrukuj
+ link: print/xml
+ params: '[]'
+ scriptlet: insert_tag
+ slug: print-xml
+ tooltip: ''
+ model: toolbar.button
+ pk: 86
+- fields:
+ accesskey: ''
+ group: [26]
+ label: przypis autorski
+ link: ''
+ params: '{"tag": "pa"}'
+ scriptlet: insert_tag
+ slug: przypis-autorski
+ tooltip: ''
+ model: toolbar.button
+ pk: 68
+- fields:
+ accesskey: ''
+ group: [26]
+ label: przypis edytorski
+ link: ''
+ params: '{"tag": "pe"}'
+ scriptlet: insert_tag
+ slug: przypis-edytorski
+ tooltip: ''
+ model: toolbar.button
+ pk: 71
+- fields:
+ accesskey: ''
+ group: [26]
+ label: przypis redaktorski
+ link: ''
+ params: '{"tag": "pr"}'
+ scriptlet: insert_tag
+ slug: przypis-redaktorski
+ tooltip: ''
+ model: toolbar.button
+ pk: 70
+- fields:
+ accesskey: ''
+ group: [26]
+ label: "przypis t\u0142umacza"
+ link: ''
+ params: '{"tag": "pt"}'
+ scriptlet: insert_tag
+ slug: przypis-tlumacza
+ tooltip: ''
+ model: toolbar.button
+ pk: 69
+- fields:
+ accesskey: ''
+ group: [1]
+ label: "rozdzia\u0142"
+ link: ''
+ params: '{"padding_top": 1, "padding_bottom": 4, "tag": "naglowek_rozdzial"}'
+ scriptlet: insert_tag
+ slug: rozdzial
+ tooltip: ''
+ model: toolbar.button
+ pk: 11
+- fields:
+ accesskey: ''
+ group: [1]
+ label: scena
+ link: ''
+ params: '{"tag": "naglowek_scena"}'
+ scriptlet: insert_tag
+ slug: scena
+ tooltip: ''
+ model: toolbar.button
+ pk: 15
+- fields:
+ accesskey: ''
+ group: [16]
+ label: asterysk
+ link: ''
+ params: '{"nocontent": "true", "tag": "sekcja_asterysk"}'
+ scriptlet: insert_tag
+ slug: sep-asterysk
+ tooltip: rozdzielenie partii tekstu asteryskiem
+ model: toolbar.button
+ pk: 54
+- fields:
+ accesskey: ''
+ group: [16]
+ label: linia
+ link: ''
+ params: '{"nocontent": "true", "tag": "separator_linia"}'
+ scriptlet: insert_tag
+ slug: sep-linia
+ tooltip: "rozdzielenie partii tekstu pozioma lini\u0105"
+ model: toolbar.button
+ pk: 55
+- fields:
+ accesskey: ''
+ group: [16]
+ label: "\u015Bwiat\u0142o"
+ link: ''
+ params: '{"nocontent": "true", "tag": "sekcja_swiatlo"}'
+ scriptlet: insert_tag
+ slug: sep-swiatlo
+ tooltip: "\u015Bwiat\u0142o rozdzielaj\u0105ce sekcje tekstu"
+ model: toolbar.button
+ pk: 53
+- fields:
+ accesskey: ''
+ group: [15]
+ label: "s\u0142owo obce"
+ link: ''
+ params: '{"tag": "slowo_obce"}'
+ scriptlet: insert_tag
+ slug: slowo-obce
+ tooltip: "frazy w j\u0119zykach innych ni\u017C polski/definiendum w przypisie"
+ model: toolbar.button
+ pk: 46
+- fields:
+ accesskey: ''
+ group: [2]
+ label: slug
+ link: ''
+ params: '[]'
+ scriptlet: slugify
+ slug: slug
+ tooltip: slugifikacja
+ model: toolbar.button
+ pk: 105
+- fields:
+ accesskey: ''
+ group: [1]
+ label: "\u015Br\xF3dtytu\u0142"
+ link: ''
+ params: '{"tag": "srodtytul"}'
+ scriptlet: insert_tag
+ slug: srodtytul
+ tooltip: ''
+ model: toolbar.button
+ pk: 13
+- fields:
+ accesskey: s
+ group: [12, 17]
+ label: strofa
+ link: ''
+ params: '{"padding_top": 1, "padding_bottom": 3, "tag": "strofa"}'
+ scriptlet: insert_stanza
+ slug: strofa
+ tooltip: "wstawia strof\u0119"
+ model: toolbar.button
+ pk: 81
+- fields:
+ accesskey: ''
+ group: [28]
+ label: strofy
+ link: ''
+ params: '{"tag": "strofa"}'
+ scriptlet: autotag
+ slug: strofy
+ tooltip: autotagowanie strof
+ model: toolbar.button
+ pk: 99
+- fields:
+ accesskey: ''
+ group: [11]
+ label: "tag g\u0142\xF3wny"
+ link: ''
+ params: '{"tag": "utwor"}'
+ scriptlet: insert_tag
+ slug: tag-glowny
+ tooltip: ''
+ model: toolbar.button
+ pk: 17
+- fields:
+ accesskey: u
+ group: [2]
+ label: "A\u2193"
+ link: ''
+ params: '[]'
+ scriptlet: lowercase
+ slug: tolowercase
+ tooltip: "Zamie\u0144 wielkie litery na ma\u0142e"
+ model: toolbar.button
+ pk: 76
+- fields:
+ accesskey: ''
+ group: [15]
+ label: "tytu\u0142 dzie\u0142a"
+ link: ''
+ params: '{"tag": "tytul_dziela"}'
+ scriptlet: insert_tag
+ slug: tytul-dziela
+ tooltip: ''
+ model: toolbar.button
+ pk: 92
+- fields:
+ accesskey: ''
+ group: [15]
+ 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:
+ accesskey: ''
+ group: [29]
+ label: uwaga
+ link: ''
+ params: '{"tag": "uwaga"}'
+ scriptlet: insert_tag
+ slug: uwaga
+ tooltip: 'uwagi redaktorsko-korektorskie '
+ model: toolbar.button
+ pk: 51
+- fields:
+ accesskey: ''
+ group: [14, 17]
+ 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:
+ accesskey: ''
+ group: [12, 17]
+ 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:
+ accesskey: w
+ group: [12, 17]
+ 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:
+ accesskey: q
+ group: [12, 17]
+ 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:
+ accesskey: ''
+ group: [28]
+ label: "wersy wci\u0119te"
+ link: ''
+ params: '{"padding": 1, "tag": "wers_wciety", "split": 1}'
+ scriptlet: autotag
+ slug: wersy-wciete
+ tooltip: "autotagowanie wers\xF3w wci\u0119tych"
+ model: toolbar.button
+ pk: 100
+- fields:
+ accesskey: ''
+ group: [15]
+ label: www
+ link: ''
+ params: '{"tag": "www"}'
+ scriptlet: insert_tag
+ slug: www
+ tooltip: ''
+ model: toolbar.button
+ pk: 48
+- fields:
+ accesskey: ''
+ group: [12, 15]
+ label: "wyr\xF3\u017Cnienie"
+ link: ''
+ params: '{"tag": "wyroznienie"}'
+ scriptlet: insert_tag
+ slug: wyroznienie
+ tooltip: "wyr\xF3\u017Cnienie autorskie"
+ model: toolbar.button
+ pk: 44
+- fields:
+ accesskey: ''
+ group: [11]
+ label: wywiad
+ link: ''
+ params: '{"padding_top": 1, "padding_bottom": 4, "tag": "wywiad"}'
+ scriptlet: insert_tag
+ slug: wywiad
+ tooltip: ''
+ model: toolbar.button
+ pk: 25
+- fields:
+ accesskey: ''
+ group: [21]
+ label: "wywiad odpowied\u017A"
+ link: ''
+ params: '{"tag": "wywiad_odp"}'
+ scriptlet: insert_tag
+ slug: wywiad-odpowiedz
+ tooltip: ''
+ model: toolbar.button
+ pk: 73
+- fields:
+ accesskey: ''
+ group: [21]
+ label: wywiad pytanie
+ link: ''
+ params: '{"tag": "wywiad_pyt"}'
+ scriptlet: insert_tag
+ slug: wywiad-pytanie
+ tooltip: ''
+ model: toolbar.button
+ pk: 72
+- fields:
+ accesskey: ''
+ group: [16]
+ 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: "$(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 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: '-'}
+ model: toolbar.scriptlet
+ pk: autotag
+- 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: "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 ? '\\\
+ n' : '') + verses[i];\r\n ebuf = '';\r\n first = false;\r\n\
+ \ } else { \r\n ebuf += '\\n' + verses[i];\r\n }\r\n };\r\
+ \n text = text + buf + '\\n' + ebuf; \r\n texteditor.replaceSelection(text);\r\
+ \n}\r\n\r\nif (!text) {\r\n var pos = texteditor.cursorPosition();\r\
+ \n texteditor.selectLines(pos.line, pos.character + 6 + 2);\r\n}\r\n\
+ \r\n\r\n\r\n\r\n\r\n\r\n\r\npanel.fireEvent('contentChanged');"}
+ model: toolbar.scriptlet
+ pk: insert_stanza
+- fields: {code: '-'}
+ model: toolbar.scriptlet
+ pk: slugify
+
diff --git a/apps/toolbar/migrations/0005_initial_data.py b/apps/toolbar/migrations/0005_initial_data.py
new file mode 100644
index 00000000..b31f3809
--- /dev/null
+++ b/apps/toolbar/migrations/0005_initial_data.py
@@ -0,0 +1,46 @@
+# encoding: utf-8
+import datetime
+from south.db import db
+from south.v2 import DataMigration
+from django.db import models
+
+class Migration(DataMigration):
+
+ def forwards(self, orm):
+ from django.core.management import call_command
+ call_command("loaddata", "initial_toolbar.yaml")
+
+
+ def backwards(self, orm):
+ "Write your backwards methods here."
+ pass
+
+
+ models = {
+ 'toolbar.button': {
+ 'Meta': {'ordering': "('slug',)", 'object_name': 'Button'},
+ 'accesskey': ('django.db.models.fields.CharField', [], {'max_length': '1', 'blank': 'True'}),
+ 'group': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['toolbar.ButtonGroup']", 'symmetrical': 'False'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
+ 'link': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}),
+ 'params': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
+ 'scriptlet': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['toolbar.Scriptlet']", 'null': 'True', 'blank': 'True'}),
+ 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'}),
+ 'tooltip': ('django.db.models.fields.CharField', [], {'max_length': '120', 'blank': 'True'})
+ },
+ 'toolbar.buttongroup': {
+ 'Meta': {'ordering': "('position', 'name')", 'object_name': 'ButtonGroup'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
+ 'position': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+ 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'})
+ },
+ 'toolbar.scriptlet': {
+ 'Meta': {'object_name': 'Scriptlet'},
+ 'code': ('django.db.models.fields.TextField', [], {}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '64', 'primary_key': 'True'})
+ }
+ }
+
+ complete_apps = ['toolbar']