punkweb-bb 0.2.3__py3-none-any.whl → 0.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. punkweb_bb/__pycache__/admin.cpython-311.pyc +0 -0
  2. punkweb_bb/__pycache__/admin_forms.cpython-311.pyc +0 -0
  3. punkweb_bb/__pycache__/bbcode.cpython-311.pyc +0 -0
  4. punkweb_bb/__pycache__/forms.cpython-311.pyc +0 -0
  5. punkweb_bb/__pycache__/middleware.cpython-311.pyc +0 -0
  6. punkweb_bb/__pycache__/mixins.cpython-311.pyc +0 -0
  7. punkweb_bb/__pycache__/models.cpython-311.pyc +0 -0
  8. punkweb_bb/__pycache__/pagination.cpython-311.pyc +0 -0
  9. punkweb_bb/__pycache__/parsers.cpython-311.pyc +0 -0
  10. punkweb_bb/__pycache__/response.cpython-311.pyc +0 -0
  11. punkweb_bb/__pycache__/settings.cpython-311.pyc +0 -0
  12. punkweb_bb/__pycache__/signals.cpython-311.pyc +0 -0
  13. punkweb_bb/__pycache__/tags.cpython-311.pyc +0 -0
  14. punkweb_bb/__pycache__/tests.cpython-311.pyc +0 -0
  15. punkweb_bb/__pycache__/urls.cpython-311.pyc +0 -0
  16. punkweb_bb/__pycache__/utils.cpython-311.pyc +0 -0
  17. punkweb_bb/__pycache__/views.cpython-311.pyc +0 -0
  18. punkweb_bb/__pycache__/widgets.cpython-311.pyc +0 -0
  19. punkweb_bb/admin.py +0 -5
  20. punkweb_bb/admin_forms.py +6 -5
  21. punkweb_bb/bbcode.py +155 -0
  22. punkweb_bb/forms.py +13 -5
  23. punkweb_bb/migrations/0005_alter_thread_options.py +24 -0
  24. punkweb_bb/migrations/0006_remove_boardprofile__signature_rendered_and_more.py +60 -0
  25. punkweb_bb/migrations/__pycache__/0005_alter_thread_options.cpython-311.pyc +0 -0
  26. punkweb_bb/migrations/__pycache__/0006_remove_boardprofile__signature_rendered_and_more.cpython-311.pyc +0 -0
  27. punkweb_bb/models.py +6 -6
  28. punkweb_bb/settings.py +1 -0
  29. punkweb_bb/static/punkweb_bb/css/defaults.css +2 -2
  30. punkweb_bb/static/punkweb_bb/css/punkweb-modal.css +2 -0
  31. punkweb_bb/static/punkweb_bb/css/punkweb.css +2 -2
  32. punkweb_bb/static/punkweb_bb/css/subcategory.css +4 -0
  33. punkweb_bb/static/punkweb_bb/css/thread.css +24 -0
  34. punkweb_bb/static/punkweb_bb/editor/bbcode-editor-content.css +4 -5
  35. punkweb_bb/static/punkweb_bb/editor/bbcode-editor.js +0 -5
  36. punkweb_bb/static/punkweb_bb/editor/markdown-editor.js +49 -0
  37. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/.eslintrc.json +15 -0
  38. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/.gitignore +108 -0
  39. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/.prettierrc.json +1 -0
  40. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/LICENSE +21 -0
  41. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/README.md +240 -0
  42. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/babel.config.json +14 -0
  43. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/dist/blank.html +18 -0
  44. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/dist/demo.html +126 -0
  45. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/dist/tiny-mde.css +231 -0
  46. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/dist/tiny-mde.js +3086 -0
  47. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/dist/tiny-mde.min.css +1 -0
  48. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/dist/tiny-mde.min.js +1 -0
  49. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/dist/tiny-mde.tiny.js +1 -0
  50. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/docs/_config.yml +1 -0
  51. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/docs/_layouts/default.html +50 -0
  52. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/docs/index.md +174 -0
  53. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/globals.d.ts +172 -0
  54. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/gulpfile.mjs +226 -0
  55. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest/block.test.js +696 -0
  56. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest/commandbar.test.js +84 -0
  57. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest/inline.test.js +486 -0
  58. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest/interaction.test.js +31 -0
  59. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest/setup.test.js +164 -0
  60. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest/util/config.js +2 -0
  61. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest/util/server.js +9 -0
  62. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest/util/setup.js +1 -0
  63. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest/util/test-helpers.js +98 -0
  64. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest-puppeteer.config.js +8 -0
  65. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest.config.js +13 -0
  66. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/package-lock.json +16295 -0
  67. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/package.json +72 -0
  68. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/TinyMDE.js +1926 -0
  69. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/TinyMDECommandBar.js +256 -0
  70. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/css/commandbar.css +72 -0
  71. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/css/editor.css +157 -0
  72. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/css/index.css +3 -0
  73. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/grammar.js +300 -0
  74. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/html/blank.html +18 -0
  75. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/html/demo.html +126 -0
  76. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/index.js +4 -0
  77. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/blockquote.svg +1 -0
  78. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/bold.svg +1 -0
  79. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/clear_formatting.svg +1 -0
  80. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/code.svg +1 -0
  81. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/h1.svg +1 -0
  82. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/h2.svg +1 -0
  83. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/hr.svg +1 -0
  84. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/image.svg +1 -0
  85. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/italic.svg +1 -0
  86. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/link.svg +1 -0
  87. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/ol.svg +1 -0
  88. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/strikethrough.svg +1 -0
  89. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/svg.js +17 -0
  90. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/ul.svg +1 -0
  91. punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/tiny.js +3 -0
  92. punkweb_bb/templates/punkweb_bb/base_delete_modal.html +13 -0
  93. punkweb_bb/templates/punkweb_bb/bbcode.html +2 -3
  94. punkweb_bb/templates/punkweb_bb/index.html +2 -2
  95. punkweb_bb/templates/punkweb_bb/partials/category_delete.html +4 -8
  96. punkweb_bb/templates/punkweb_bb/partials/post_delete.html +4 -8
  97. punkweb_bb/templates/punkweb_bb/partials/shout_delete.html +4 -8
  98. punkweb_bb/templates/punkweb_bb/partials/subcategory_delete.html +4 -8
  99. punkweb_bb/templates/punkweb_bb/partials/thread_delete.html +4 -8
  100. punkweb_bb/templates/punkweb_bb/partials/thread_move.html +24 -0
  101. punkweb_bb/templates/punkweb_bb/profile.html +2 -2
  102. punkweb_bb/templates/punkweb_bb/shoutbox/shout_list.html +2 -2
  103. punkweb_bb/templates/punkweb_bb/subcategory.html +1 -1
  104. punkweb_bb/templates/punkweb_bb/thread.html +24 -14
  105. punkweb_bb/templates/punkweb_bb/widgets/markdown-editor.html +4 -0
  106. punkweb_bb/templatetags/__pycache__/markdown.cpython-311.pyc +0 -0
  107. punkweb_bb/templatetags/__pycache__/render.cpython-311.pyc +0 -0
  108. punkweb_bb/templatetags/__pycache__/shoutbox_bbcode.cpython-311.pyc +0 -0
  109. punkweb_bb/templatetags/__pycache__/shoutbox_render.cpython-311.pyc +0 -0
  110. punkweb_bb/templatetags/render.py +35 -0
  111. punkweb_bb/tests.py +3 -3
  112. punkweb_bb/urls.py +1 -0
  113. punkweb_bb/utils.py +24 -10
  114. punkweb_bb/views.py +45 -23
  115. punkweb_bb/widgets.py +20 -0
  116. {punkweb_bb-0.2.3.dist-info → punkweb_bb-0.4.0.dist-info}/METADATA +58 -51
  117. {punkweb_bb-0.2.3.dist-info → punkweb_bb-0.4.0.dist-info}/RECORD +120 -53
  118. punkweb_bb/bbcode_tags.py +0 -167
  119. punkweb_bb/parsers.py +0 -70
  120. punkweb_bb/templatetags/shoutbox_bbcode.py +0 -14
  121. {punkweb_bb-0.2.3.dist-info → punkweb_bb-0.4.0.dist-info}/LICENSE +0 -0
  122. {punkweb_bb-0.2.3.dist-info → punkweb_bb-0.4.0.dist-info}/WHEEL +0 -0
  123. {punkweb_bb-0.2.3.dist-info → punkweb_bb-0.4.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,300 @@
1
+ // const replacements = {
2
+ // ASCIIPunctuation: '!"#$%&\'()*+,\\-./:;<=>?@\\[\\]^_`{|}~',
3
+ // TriggerChars: '`_\*\[\]\(\)',
4
+ // Scheme: `[A-Za-z][A-Za-z0-9\+\.\-]{1,31}`,
5
+ // Email: `[a-zA-Z0-9.!#$%&'*+/=?^_\`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*`, // From CommonMark spec
6
+
7
+ // }
8
+ const replacements = {
9
+ ASCIIPunctuation: /[!"#$%&'()*+,\-./:;<=>?@[\]^_`{|}~\\]/,
10
+ NotTriggerChar: /[^`_*[\]()<>!~]/,
11
+ Scheme: /[A-Za-z][A-Za-z0-9+.-]{1,31}/,
12
+ Email: /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*/, // From CommonMark spec
13
+ HTMLOpenTag: /<HTMLTagName(?:HTMLAttribute)*\s*\/?>/,
14
+ HTMLCloseTag: /<\/HTMLTagName\s*>/,
15
+ HTMLTagName: /[A-Za-z][A-Za-z0-9-]*/,
16
+ HTMLComment: /<!--(?:[^>-]|(?:[^>-](?:[^-]|-[^-])*[^-]))-->/,
17
+ HTMLPI: /<\?(?:|.|(?:[^?]|\?[^>])*)\?>/,
18
+ HTMLDeclaration: /<![A-Z]+\s[^>]*>/,
19
+ HTMLCDATA: /<!\[CDATA\[.*?\]\]>/,
20
+ HTMLAttribute: /\s+[A-Za-z_:][A-Za-z0-9_.:-]*(?:HTMLAttValue)?/,
21
+ HTMLAttValue: /\s*=\s*(?:(?:'[^']*')|(?:"[^"]*")|(?:[^\s"'=<>`]+))/,
22
+ KnownTag: /address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul/
23
+ }
24
+
25
+ // From CommonMark.js.
26
+ const punctuationLeading = new RegExp(/^(?:[!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B])/);
27
+
28
+ const punctuationTrailing = new RegExp(/(?:[!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B])$/);
29
+
30
+ // export const inlineTriggerChars = new RegExp(`[${replacements.TriggerChars}]`);
31
+
32
+ /**
33
+ * This is CommonMark's block grammar, but we're ignoring nested blocks here.
34
+ */
35
+ const lineGrammar = {
36
+ TMH1: {
37
+ regexp: /^( {0,3}#\s)(.*?)((?:\s+#+\s*)?)$/,
38
+ replacement: '<span class="TMMark TMMark_TMH1">$1</span>$$2<span class="TMMark TMMark_TMH1">$3</span>'
39
+ },
40
+ TMH2: {
41
+ regexp: /^( {0,3}##\s)(.*?)((?:\s+#+\s*)?)$/,
42
+ replacement: '<span class="TMMark TMMark_TMH2">$1</span>$$2<span class="TMMark TMMark_TMH2">$3</span>'
43
+ },
44
+ TMH3: {
45
+ regexp: /^( {0,3}###\s)(.*?)((?:\s+#+\s*)?)$/,
46
+ replacement: '<span class="TMMark TMMark_TMH3">$1</span>$$2<span class="TMMark TMMark_TMH3">$3</span>'
47
+ },
48
+ TMH4: {
49
+ regexp: /^( {0,3}####\s)(.*?)((?:\s+#+\s*)?)$/,
50
+ replacement: '<span class="TMMark TMMark_TMH4">$1</span>$$2<span class="TMMark TMMark_TMH4">$3</span>'
51
+ },
52
+ TMH5: {
53
+ regexp: /^( {0,3}#####\s)(.*?)((?:\s+#+\s*)?)$/,
54
+ replacement: '<span class="TMMark TMMark_TMH5">$1</span>$$2<span class="TMMark TMMark_TMH5">$3</span>'
55
+ },
56
+ TMH6: {
57
+ regexp: /^( {0,3}######\s)(.*?)((?:\s+#+\s*)?)$/,
58
+ replacement: '<span class="TMMark TMMark_TMH6">$1</span>$$2<span class="TMMark TMMark_TMH6">$3</span>'
59
+ },
60
+ TMBlockquote: {
61
+ regexp: /^( {0,3}>[ ]?)(.*)$/,
62
+ replacement: '<span class="TMMark TMMark_TMBlockquote">$1</span>$$2'
63
+ },
64
+ TMCodeFenceBacktickOpen: {
65
+ regexp: /^( {0,3}(?<seq>````*)\s*)([^`]*?)(\s*)$/,
66
+ replacement: '<span class="TMMark TMMark_TMCodeFenceBacktick">$1</span><span class="TMInfoString">$3</span>$4'
67
+ },
68
+ TMCodeFenceTildeOpen: {
69
+ regexp: /^( {0,3}(?<seq>~~~~*)\s*)(.*?)(\s*)$/,
70
+ replacement: '<span class="TMMark TMMark_TMCodeFenceTilde">$1</span><span class="TMInfoString">$3</span>$4'
71
+ },
72
+ TMCodeFenceBacktickClose: {
73
+ regexp: /^( {0,3}(?<seq>````*))(\s*)$/,
74
+ replacement: '<span class="TMMark TMMark_TMCodeFenceBacktick">$1</span>$3'
75
+ },
76
+ TMCodeFenceTildeClose: {
77
+ regexp: /^( {0,3}(?<seq>~~~~*))(\s*)$/,
78
+ replacement: '<span class="TMMark TMMark_TMCodeFenceTilde">$1</span>$3'
79
+ },
80
+ TMBlankLine: {
81
+ regexp: /^([ \t]*)$/,
82
+ replacement: '$0'
83
+ },
84
+ TMSetextH1Marker: {
85
+ regexp: /^ {0,3}=+\s*$/,
86
+ replacement: '<span class="TMMark TMMark_TMSetextH1Marker">$0</span>'
87
+ },
88
+ TMSetextH2Marker: {
89
+ regexp: /^ {0,3}-+\s*$/,
90
+ replacement: '<span class="TMMark TMMark_TMSetextH1Marker">$0</span>'
91
+ },
92
+ TMHR: {
93
+ regexp: /^( {0,3}(\*[ \t]*\*[ \t]*\*[ \t*]*)|(-[ \t]*-[ \t]*-[ \t-]*)|(_[ \t]*_[ \t]*_[ \t_]*))$/,
94
+ replacement: '<span class="TMMark TMMark_TMHR">$0</span>'
95
+ },
96
+ TMUL: {
97
+ regexp: /^( {0,3}[+*-] {1,4})(.*)$/,
98
+ replacement: '<span class="TMMark TMMark_TMUL">$1</span>$$2'
99
+ },
100
+ TMOL: {
101
+ regexp: /^( {0,3}\d{1,9}[.)] {1,4})(.*)$/,
102
+ replacement: '<span class="TMMark TMMark_TMOL">$1</span>$$2'
103
+ },
104
+ // TODO: This is currently preventing sublists (and any content within list items, really) from working
105
+ TMIndentedCode: {
106
+ regexp: /^( {4}|\t)(.*)$/,
107
+ replacement: '<span class="TMMark TMMark_TMIndentedCode">$1</span>$2'
108
+ },
109
+ TMLinkReferenceDefinition: {
110
+ // TODO: Link destination can't include unbalanced parantheses, but we just ignore that here
111
+ regexp: /^( {0,3}\[\s*)([^\s\]](?:[^\]]|\\\])*?)(\s*\]:\s*)((?:[^\s<>]+)|(?:<(?:[^<>\\]|\\.)*>))?(\s*)((?:\((?:[^()\\]|\\.)*\))|(?:"(?:[^"\\]|\\.)*")|(?:'(?:[^'\\]|\\.)*'))?(\s*)$/,
112
+ replacement: '<span class="TMMark TMMark_TMLinkReferenceDefinition">$1</span><span class="TMLinkLabel TMLinkLabel_Definition">$2</span><span class="TMMark TMMark_TMLinkReferenceDefinition">$3</span><span class="TMLinkDestination">$4</span>$5<span class="TMLinkTitle">$6</span>$7',
113
+ labelPlaceholder: 2, // this defines which placeholder in the above regex is the link "label"
114
+ },
115
+ };
116
+
117
+ /**
118
+ * HTML blocks have multiple different classes of opener and closer. This array defines all the cases
119
+ */
120
+ var htmlBlockGrammar = [
121
+ { start: /^ {0,3}<(?:script|pre|style)(?:\s|>|$)/i, end: /(?:<\/script>|<\/pre>|<\/style>)/i, paraInterrupt: true },
122
+ { start: /^ {0,3}<!--/, end: /-->/, paraInterrupt: true },
123
+ { start: /^ {0,3}<\?/, end: /\?>/, paraInterrupt: true },
124
+ { start: /^ {0,3}<![A-Z]/, end: />/, paraInterrupt : true},
125
+ { start: /^ {0,3}<!\[CDATA\[/, end: /\]\]>/, paraInterrupt : true},
126
+ { start: /^ {0,3}(?:<|<\/)(?:KnownTag)(?:\s|>|\/>|$)/i, end: false, paraInterrupt: true},
127
+ { start: /^ {0,3}(?:HTMLOpenTag|HTMLCloseTag)\s*$/, end: false, paraInterrupt: false},
128
+ ];
129
+
130
+ /**
131
+ * Structure of the object:
132
+ * Top level entries are rules, each consisting of a regular expressions (in string format) as well as a replacement.
133
+ * In the regular expressions, replacements from the object 'replacements' will be processed before compiling into the property regexp.
134
+ */
135
+ var inlineGrammar = {
136
+ escape : {
137
+ regexp: /^\\(ASCIIPunctuation)/,
138
+ replacement : '<span class="TMMark TMMark_TMEscape">\\</span>$1'
139
+ },
140
+ code : {
141
+ regexp: /^(`+)((?:[^`])|(?:[^`].*?[^`]))(\1)/,
142
+ replacement : '<span class="TMMark TMMark_TMCode">$1</span><code class="TMCode">$2</code><span class="TMMark TMMark_TMCode">$3</span>'
143
+ },
144
+ autolink : {
145
+ regexp: /^<((?:Scheme:[^\s<>]*)|(?:Email))>/,
146
+ replacement: '<span class="TMMark TMMark_TMAutolink">&lt;</span><span class="TMAutolink">$1</span><span class="TMMark TMMark_TMAutolink">&gt;</span>'
147
+ },
148
+ html : {
149
+ regexp: /^((?:HTMLOpenTag)|(?:HTMLCloseTag)|(?:HTMLComment)|(?:HTMLPI)|(?:HTMLDeclaration)|(?:HTMLCDATA))/,
150
+ replacement: '<span class="TMHTML">$1</span>',
151
+ },
152
+ linkOpen : {
153
+ regexp: /^\[/,
154
+ replacement: ''
155
+ },
156
+ imageOpen : {
157
+ regexp: /^!\[/,
158
+ replacement : ''
159
+ },
160
+ linkLabel : {
161
+ regexp: /^(\[\s*)([^\]]*?)(\s*\])/,
162
+ replacement: '',
163
+ labelPlaceholder: 2
164
+ },
165
+ default : {
166
+ regexp: /^(.|(?:NotTriggerChar+))/,
167
+ replacement: '$1'
168
+ }
169
+ };
170
+
171
+ // Process replacements in regexps
172
+ const replacementRegexp = new RegExp(Object.keys(replacements).join('|'));
173
+
174
+ // Inline
175
+ const inlineRules =[...Object.keys(inlineGrammar)];
176
+ for (let rule of inlineRules) {
177
+ let re = inlineGrammar[rule].regexp.source;
178
+ // Replace while there is something to replace. This means it also works over multiple levels (replacements containing replacements)
179
+ while (re.match(replacementRegexp)) {
180
+ re = re.replace(replacementRegexp, (string) => { return replacements[string].source; });
181
+ }
182
+ inlineGrammar[rule].regexp = new RegExp(re, inlineGrammar[rule].regexp.flags);
183
+ }
184
+
185
+ // HTML Block (only opening rule is processed currently)
186
+ for (let rule of htmlBlockGrammar) {
187
+ let re = rule.start.source;
188
+ // Replace while there is something to replace. This means it also works over multiple levels (replacements containing replacements)
189
+ while (re.match(replacementRegexp)) {
190
+ re = re.replace(replacementRegexp, (string) => { return replacements[string].source; });
191
+ }
192
+ rule.start = new RegExp(re, rule.start.flags);
193
+ }
194
+
195
+ /**
196
+ * Escapes HTML special characters (<, >, and &) in the string.
197
+ * @param {string} string The raw string to be escaped
198
+ * @returns {string} The string, ready to be used in HTML
199
+ */
200
+ function htmlescape(string) {
201
+ return (string ? string : '')
202
+ .replace(/&/g, '&amp;')
203
+ .replace(/</g, '&lt;')
204
+ .replace(/>/g, '&gt;');
205
+ }
206
+ /**
207
+ * Contains the commands that can be sent to the editor. Contains objects with a name representing the name of the command.
208
+ * Each of the objects contains the following keys:
209
+ *
210
+ * - type: Can be either inline (for inline formatting) or line (for block / line formatting).
211
+ * - className: Used to determine whether the command is active at a given position.
212
+ * For line formatting, this looks at the class of the line element. For inline elements, tries to find an enclosing element with that class.
213
+ * - set / unset: Contain instructions how to set and unset the command. For line type commands, both consist of a pattern and replacement that
214
+ * will be applied to each line (using String.replace). For inline type commands, the set object contains a pre and post string which will
215
+ * be inserted before and after the selection. The unset object contains a prePattern and a postPattern. Both should be regular expressions and
216
+ * they will be applied to the portion of the line before and after the selection (using String.replace, with an empty replacement string).
217
+ */
218
+ const commands = {
219
+ // Replacements for unset for inline commands are '' by default
220
+ bold: {
221
+ type: 'inline',
222
+ className: 'TMStrong',
223
+ set: {pre: '**', post: '**'},
224
+ unset: {prePattern: /(?:\*\*|__)$/, postPattern: /^(?:\*\*|__)/}
225
+ },
226
+ italic: {
227
+ type: 'inline',
228
+ className: 'TMEm',
229
+ set: {pre: '*', post: '*'},
230
+ unset: {prePattern: /(?:\*|_)$/, postPattern: /^(?:\*|_)/}
231
+ },
232
+ code: {
233
+ type: 'inline',
234
+ className: 'TMCode',
235
+ set: {pre: '`', post: '`'},
236
+ unset: {prePattern: /`+$/, postPattern: /^`+/} // FIXME this doesn't ensure balanced backticks right now
237
+ },
238
+ strikethrough: {
239
+ type: 'inline',
240
+ className: 'TMStrikethrough',
241
+ set: {pre: '~~', post: '~~'},
242
+ unset: {prePattern:/~~$/, postPattern: /^~~/ }
243
+ },
244
+ h1: {
245
+ type: 'line',
246
+ className: 'TMH1',
247
+ set: {pattern: /^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/, replacement: '# $2'},
248
+ unset: {pattern: /^( {0,3}#\s+)(.*?)((?:\s+#+\s*)?)$/, replacement: '$2'}
249
+ },
250
+ h2: {
251
+ type: 'line',
252
+ className: 'TMH2',
253
+ set: {pattern: /^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/, replacement: '## $2'},
254
+ unset: {pattern: /^( {0,3}##\s+)(.*?)((?:\s+#+\s*)?)$/, replacement: '$2'}
255
+ },
256
+ h3: {
257
+ type: 'line',
258
+ className: 'TMH3',
259
+ set: {pattern: /^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/, replacement: '### $2'},
260
+ unset: {pattern: /^( {0,3}###\s+)(.*?)((?:\s+#+\s*)?)$/, replacement: '$2'}
261
+ },
262
+ h4: {
263
+ type: 'line',
264
+ className: 'TMH4',
265
+ set: {pattern: /^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/, replacement: '#### $2'},
266
+ unset: {pattern: /^( {0,3}####\s+)(.*?)((?:\s+#+\s*)?)$/, replacement: '$2'}
267
+ },
268
+ h5: {
269
+ type: 'line',
270
+ className: 'TMH5',
271
+ set: {pattern: /^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/, replacement: '##### $2'},
272
+ unset: {pattern: /^( {0,3}#####\s+)(.*?)((?:\s+#+\s*)?)$/, replacement: '$2'}
273
+ },
274
+ h6: {
275
+ type: 'line',
276
+ className: 'TMH6',
277
+ set: {pattern: /^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/, replacement: '###### $2'},
278
+ unset: {pattern: /^( {0,3}######\s+)(.*?)((?:\s+#+\s*)?)$/, replacement: '$2'}
279
+ },
280
+ ul: {
281
+ type: 'line',
282
+ className: 'TMUL',
283
+ set: {pattern: /^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/, replacement: '- $2'},
284
+ unset: {pattern: /^( {0,3}[+*-] {1,4})(.*)$/, replacement: '$2'}
285
+ },
286
+ ol: {
287
+ type: 'line',
288
+ className: 'TMOL',
289
+ set: {pattern: /^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/, replacement: '$#. $2'},
290
+ unset: {pattern: /^( {0,3}\d{1,9}[.)] {1,4})(.*)$/, replacement: '$2'}
291
+ },
292
+ blockquote: {
293
+ type: 'line',
294
+ className: 'TMBlockquote',
295
+ set: {pattern: /^( {0,3}(?:(?:#+|[0-9]{1,9}[).]|[>\-*+])\s+)?)(.*)$/, replacement: '> $2'},
296
+ unset: {pattern: /^( {0,3}>[ ]?)(.*)$/, replacement: '$2'}
297
+ },
298
+ };
299
+
300
+ export { lineGrammar, inlineGrammar, punctuationLeading, punctuationTrailing, htmlescape, htmlBlockGrammar, commands };
@@ -0,0 +1,18 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>TinyMDE demo</title>
5
+ <script src="./tiny-mde.js"></script>
6
+ <link rel="stylesheet" type="text/css" href="./tiny-mde.min.css" />
7
+ <meta name="viewport" content="initial-scale=1.0">
8
+ <style type="text/css">
9
+ html, body, div {
10
+ margin: 0px;
11
+ padding: 0px;
12
+ }</style>
13
+ </head>
14
+ <body>
15
+ <div id="tinymde_commandbar"></div>
16
+ <div id="tinymde" style="height:300px; overflow-y:scroll; border:1px solid #c0c0c0"></div>
17
+ </body>
18
+ </html>
@@ -0,0 +1,126 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>TinyMDE demo</title>
5
+ <script src="./tiny-mde.js"></script>
6
+ <link rel="stylesheet" type="text/css" href="./tiny-mde.min.css" />
7
+ <meta name="viewport" content="initial-scale=1.0">
8
+ </head>
9
+ <body>
10
+ <h1>TinyMDE demo</h1>
11
+
12
+ <div id="tinymde_commandbar"></div>
13
+ <div id="tinymde" style="height:300px; overflow-y:scroll; border:1px solid #c0c0c0">
14
+ <textarea id="txt"># Hello TinyMDE
15
+ [ref]: https://www.jefago.com
16
+ [ref link]: </this has spaces> "and a title"
17
+
18
+
19
+ Some <html> </tags> right here
20
+ <html a="b" >
21
+
22
+ More <html a="b c" d = 'e f' h = i j /> here
23
+ Comment <!-- here --> and <!-- not -- a --> comment and neither here <!---->
24
+ Test <a foo="bar" bam = 'baz <em>"</em>' _boolean zoop:33=zoop:33 /> case
25
+ Illegal HTML <__> <33> <a h*ref="hi"> <a href="hi'> <a href=hi'> < a> <a/ > <foo bar=baz bim!bop /> <a href='a'title=title>
26
+ Processing instructions <?here?> and <? h e r e ?> and <?a?> here and <??> here and <? here ? here > here ?> yup
27
+ Declarations <!DOCTYPE html> and <!DECLARE > and <!DO the OK@#( fwekof'230-2= πππ> here but <!NOT> here
28
+ A <![CDATA[section right ] freak > ing ]] here]]> but not anymore
29
+ Autolink, not inline link: [this <https://]()>
30
+ HTML, not inline link: [this <html a="]()">
31
+ More `complex` line with *one **style** within* another.
32
+ Code `ends here\` not here`
33
+ More ``difficult `code`` spans \`not code` \\"
34
+ Code `` `that starts `` with a backtick
35
+ This is [not `a ](link) right` here.
36
+
37
+ [ref]: https://www.jefago.com
38
+ [ref link]: </this has spaces> "and a title"
39
+ [ link label ]: "Only title, spaces in the label"
40
+
41
+
42
+ Autolinks
43
+ ---------
44
+ <mail@jefago.com> <https://www.jefago.com/> <a+b:>
45
+
46
+
47
+ [invalid]
48
+ [invalid][]
49
+ [in-valid][invalid]
50
+ This foo-_(bar)_ should
51
+ THis _(also)_ should
52
+ Only _underscores_ in this line
53
+ There's <html><like><tags><over><here>
54
+ A [ref link] in here.
55
+ And another [ref link][].
56
+ A valid [link to a ref][ref] here.
57
+ An invalid [ref link][nope].
58
+ An [inline link](/inline) here.
59
+ Some [inline](<links>) [inline](<link link> "title title") [inline](<link link> (title title)) [inline]( <link link> 'title \\' title') ss
60
+ [Inline]( /with invalid title text ) here.
61
+ [Inline]( </with (complex) dest> (and title text) ) here.
62
+ [Inline](<> "") link with empty delimiters
63
+ [Inline]() link completely empty
64
+ [Valid link](")))") here
65
+ [Valid link](<)))>) here
66
+ [Invalid]( ( ) here
67
+ This one [is *a](link) over* here, but not an emphasis.
68
+ Here [the [inner](one) is] the valid link.
69
+ An ![image [can](have) a](link) inside it.
70
+ This **is** a test.
71
+
72
+ *Full line emphasized*
73
+ Open ***without* close
74
+ Both __types__ of *delimiters*
75
+ __*Mixed* and matched__
76
+ __mixed*_ and *unmatched_
77
+ Close **without* open** test
78
+ ab**cd*e*f*g*h**i*j*k
79
+ Several *em* phasized *words and* some *phrases*.
80
+ Triple ***emphasis***.
81
+ One *emphasis *within* another*.
82
+
83
+ H1
84
+ ==
85
+ Hello *there*.
86
+ ~~~
87
+ Code
88
+ block
89
+ ~~~
90
+
91
+
92
+ > Quote and
93
+ Indented code block
94
+
95
+ * * *
96
+
97
+ - UL
98
+ - UL (and an empty one below)
99
+ -
100
+
101
+ 1) OL
102
+ 2) OL</textarea>
103
+ </div>
104
+ <div id="status" style="text-align:right">- : -</div>
105
+ <script>
106
+ // Create editor element, initialized to a textarea
107
+ tinyMDE = new TinyMDE.Editor({textarea: 'txt'});
108
+
109
+ // Create a command bar for that editor
110
+ cmdBar = new TinyMDE.CommandBar({
111
+ element: 'tinymde_commandbar',
112
+ editor: tinyMDE,
113
+ });
114
+
115
+ // Add a custom selection event listener
116
+ tinyMDE.addEventListener('selection', (e) => {
117
+ let st = `${e.focus ? e.focus.row : '–'} : ${e.focus ? e.focus.col : '–'}`;
118
+ for (let command in e.commandState) {
119
+ if (e.commandState[command]) st = command.concat(' ', st);
120
+ }
121
+ document.getElementById('status').innerHTML = st;
122
+ });
123
+ </script>
124
+
125
+ </body>
126
+ </html>
@@ -0,0 +1,4 @@
1
+ import CommandBar from "./TinyMDECommandBar";
2
+ import Editor from "./TinyMDE";
3
+
4
+ export {Editor, CommandBar};
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="m228-240 92-160q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 23-5.5 42.5T458-480L320-240h-92Zm360 0 92-160q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 23-5.5 42.5T818-480L680-240h-92ZM320-500q25 0 42.5-17.5T380-560q0-25-17.5-42.5T320-620q-25 0-42.5 17.5T260-560q0 25 17.5 42.5T320-500Zm360 0q25 0 42.5-17.5T740-560q0-25-17.5-42.5T680-620q-25 0-42.5 17.5T620-560q0 25 17.5 42.5T680-500Zm0-60Zm-360 0Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200H272Zm121-112h104q48 0 58.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95v109Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="m528-546-93-93-121-121h486v120H568l-40 94ZM792-56 460-388l-80 188H249l119-280L56-792l56-56 736 736-56 56Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="M320-240 80-480l240-240 57 57-184 184 183 183-56 56Zm320 0-57-57 184-184-183-183 56-56 240 240-240 240Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="M200-280v-400h80v160h160v-160h80v400h-80v-160H280v160h-80Zm480 0v-320h-80v-80h160v400h-80Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="M120-280v-400h80v160h160v-160h80v400h-80v-160H200v160h-80Zm400 0v-160q0-33 23.5-56.5T600-520h160v-80H520v-80h240q33 0 56.5 23.5T840-600v80q0 33-23.5 56.5T760-440H600v80h240v80H520Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="M160-440v-80h640v80H160Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm180 440v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="M80-400v-80h800v80H80Zm340-160v-120H200v-120h560v120H540v120H420Zm0 400v-160h120v160H420Z"/></svg>
@@ -0,0 +1,17 @@
1
+ const svg = {
2
+ blockquote: `<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="m228-240 92-160q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 23-5.5 42.5T458-480L320-240h-92Zm360 0 92-160q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 23-5.5 42.5T818-480L680-240h-92ZM320-500q25 0 42.5-17.5T380-560q0-25-17.5-42.5T320-620q-25 0-42.5 17.5T260-560q0 25 17.5 42.5T320-500Zm360 0q25 0 42.5-17.5T740-560q0-25-17.5-42.5T680-620q-25 0-42.5 17.5T620-560q0 25 17.5 42.5T680-500Zm0-60Zm-360 0Z"/></svg>`,
3
+ bold: `<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200H272Zm121-112h104q48 0 58.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95v109Z"/></svg>`,
4
+ clear_formatting: `<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="m528-546-93-93-121-121h486v120H568l-40 94ZM792-56 460-388l-80 188H249l119-280L56-792l56-56 736 736-56 56Z"/></svg>`,
5
+ code: `<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="M320-240 80-480l240-240 57 57-184 184 183 183-56 56Zm320 0-57-57 184-184-183-183 56-56 240 240-240 240Z"/></svg>`,
6
+ h1: `<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="M200-280v-400h80v160h160v-160h80v400h-80v-160H280v160h-80Zm480 0v-320h-80v-80h160v400h-80Z"/></svg>`,
7
+ h2: `<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="M120-280v-400h80v160h160v-160h80v400h-80v-160H200v160h-80Zm400 0v-160q0-33 23.5-56.5T600-520h160v-80H520v-80h240q33 0 56.5 23.5T840-600v80q0 33-23.5 56.5T760-440H600v80h240v80H520Z"/></svg>`,
8
+ hr: `<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="M160-440v-80h640v80H160Z"/></svg>`,
9
+ image: `<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"/></svg>`,
10
+ italic: `<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"/></svg>`,
11
+ link: `<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"/></svg>`,
12
+ ol: `<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="M120-80v-60h100v-30h-60v-60h60v-30H120v-60h120q17 0 28.5 11.5T280-280v40q0 17-11.5 28.5T240-200q17 0 28.5 11.5T280-160v40q0 17-11.5 28.5T240-80H120Zm0-280v-110q0-17 11.5-28.5T160-510h60v-30H120v-60h120q17 0 28.5 11.5T280-560v70q0 17-11.5 28.5T240-450h-60v30h100v60H120Zm60-280v-180h-60v-60h120v240h-60Zm180 440v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360Z"/></svg>`,
13
+ strikethrough: `<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="M80-400v-80h800v80H80Zm340-160v-120H200v-120h560v120H540v120H420Zm0 400v-160h120v160H420Z"/></svg>`,
14
+ ul: `<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="M360-200v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360ZM200-160q-33 0-56.5-23.5T120-240q0-33 23.5-56.5T200-320q33 0 56.5 23.5T280-240q0 33-23.5 56.5T200-160Zm0-240q-33 0-56.5-23.5T120-480q0-33 23.5-56.5T200-560q33 0 56.5 23.5T280-480q0 33-23.5 56.5T200-400Zm0-240q-33 0-56.5-23.5T120-720q0-33 23.5-56.5T200-800q33 0 56.5 23.5T280-720q0 33-23.5 56.5T200-640Z"/></svg>`
15
+ };
16
+
17
+ export default svg;
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="M360-200v-80h480v80H360Zm0-240v-80h480v80H360Zm0-240v-80h480v80H360ZM200-160q-33 0-56.5-23.5T120-240q0-33 23.5-56.5T200-320q33 0 56.5 23.5T280-240q0 33-23.5 56.5T200-160Zm0-240q-33 0-56.5-23.5T120-480q0-33 23.5-56.5T200-560q33 0 56.5 23.5T280-480q0 33-23.5 56.5T200-400Zm0-240q-33 0-56.5-23.5T120-720q0-33 23.5-56.5T200-800q33 0 56.5 23.5T280-720q0 33-23.5 56.5T200-640Z"/></svg>
@@ -0,0 +1,3 @@
1
+ import Editor from "./TinyMDE";
2
+
3
+ export {Editor};
@@ -0,0 +1,13 @@
1
+ {% extends 'punkweb_bb/base_modal.html' %}
2
+
3
+ {% block content %}
4
+ <p>
5
+ Are you sure you want to delete this {% block object_type %}{% endblock %}?
6
+ <br />
7
+ <b>This action cannot be undone!</b>
8
+ </p>
9
+ <div class="modal__actions">
10
+ <button class="modal__cancel pw-button default">Cancel</button>
11
+ <button class="pw-button raised danger" hx-delete="{% block delete_url %}{% endblock %}">Delete</button>
12
+ </div>
13
+ {% endblock %}
@@ -1,6 +1,5 @@
1
1
  {% extends "punkweb_bb/base.html" %}
2
-
3
- {% load bbcode_tags %}
2
+ {% load render %}
4
3
 
5
4
  {% block content %}
6
5
 
@@ -11,7 +10,7 @@
11
10
  <div>
12
11
  <h4>{{ code.0 }}</h4>
13
12
  <pre>{{ code.1 }}</pre>
14
- {% bbcode code.1 %}
13
+ {{ code.1|render }}
15
14
  </div>
16
15
  {% endfor %}
17
16
  </div>
@@ -1,6 +1,6 @@
1
1
  {% extends 'punkweb_bb/base.html' %}
2
2
 
3
- {% load static bbcode_tags styled_username %}
3
+ {% load static render styled_username %}
4
4
 
5
5
  {% block extra_head %}
6
6
  <link rel="stylesheet" href="{% static 'punkweb_bb/css/index.css' %}" />
@@ -75,7 +75,7 @@
75
75
  <td>
76
76
  <a href="{{subcategory.get_absolute_url}}" title="{{subcategory.name}}">{{subcategory.name}}</a>
77
77
  <div>
78
- {{subcategory.description.rendered}}
78
+ {{subcategory.description|render}}
79
79
  </div>
80
80
  </td>
81
81
  <td>{{subcategory.thread_count}}</td>
@@ -1,11 +1,7 @@
1
- {% extends 'punkweb_bb/base_modal.html' %}
1
+ {% extends 'punkweb_bb/base_delete_modal.html' %}
2
2
 
3
3
  {% block title %}Delete Category{% endblock %}
4
4
 
5
- {% block content %}
6
- <p>Are you sure you want to delete this category? This action cannot be undone!</p>
7
- <div class="modal__actions">
8
- <button class="modal__cancel pw-button default">Cancel</button>
9
- <button class="pw-button raised danger" hx-delete="{% url 'punkweb_bb:category_delete' category.slug %}">Delete</button>
10
- </div>
11
- {% endblock %}
5
+ {% block object_type %}category{% endblock %}
6
+
7
+ {% block delete_url %}{% url 'punkweb_bb:category_delete' category.slug %}{% endblock %}
@@ -1,11 +1,7 @@
1
- {% extends 'punkweb_bb/base_modal.html' %}
1
+ {% extends 'punkweb_bb/base_delete_modal.html' %}
2
2
 
3
3
  {% block title %}Delete Post{% endblock %}
4
4
 
5
- {% block content %}
6
- <p>Are you sure you want to delete this post? This action cannot be undone!</p>
7
- <div class="modal__actions">
8
- <button class="modal__cancel pw-button default">Cancel</button>
9
- <button class="pw-button raised danger" hx-delete="{% url 'punkweb_bb:post_delete' post.id %}">Delete</button>
10
- </div>
11
- {% endblock %}
5
+ {% block object_type %}post{% endblock %}
6
+
7
+ {% block delete_url %}{% url 'punkweb_bb:post_delete' post.id %}{% endblock %}
@@ -1,11 +1,7 @@
1
- {% extends 'punkweb_bb/base_modal.html' %}
1
+ {% extends 'punkweb_bb/base_delete_modal.html' %}
2
2
 
3
3
  {% block title %}Delete Shout{% endblock %}
4
4
 
5
- {% block content %}
6
- <p>Are you sure you want to delete this shout? This action cannot be undone!</p>
7
- <div class="modal__actions">
8
- <button class="modal__cancel pw-button default">Cancel</button>
9
- <button class="pw-button raised danger" hx-delete="{% url 'punkweb_bb:shout_delete' shout.id %}">Delete</button>
10
- </div>
11
- {% endblock %}
5
+ {% block object_type %}shout{% endblock %}
6
+
7
+ {% block delete_url %}{% url 'punkweb_bb:shout_delete' shout.id %}{% endblock %}