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
Binary file
punkweb_bb/admin.py CHANGED
@@ -1,5 +1,4 @@
1
1
  from django.contrib import admin
2
- from django.utils.safestring import mark_safe
3
2
 
4
3
  from punkweb_bb.admin_forms import (
5
4
  BoardProfileAdminModelForm,
@@ -34,10 +33,6 @@ class BoardProfileModelAdmin(admin.ModelAdmin):
34
33
  "user__username",
35
34
  "user__email",
36
35
  )
37
- readonly_fields = ("signature_rendered",)
38
-
39
- def signature_rendered(self, obj):
40
- return mark_safe(obj.signature.rendered)
41
36
 
42
37
 
43
38
  @admin.register(Category)
punkweb_bb/admin_forms.py CHANGED
@@ -8,6 +8,7 @@ from punkweb_bb.models import (
8
8
  Subcategory,
9
9
  Thread,
10
10
  )
11
+ from punkweb_bb.utils import get_editor_widget
11
12
  from punkweb_bb.widgets import BBCodeEditorWidget
12
13
 
13
14
 
@@ -16,7 +17,7 @@ class BoardProfileAdminModelForm(forms.ModelForm):
16
17
  model = BoardProfile
17
18
  fields = "__all__"
18
19
  widgets = {
19
- "signature": BBCodeEditorWidget(),
20
+ "signature": get_editor_widget(),
20
21
  }
21
22
 
22
23
 
@@ -25,7 +26,7 @@ class CategoryAdminModelForm(forms.ModelForm):
25
26
  model = Category
26
27
  fields = "__all__"
27
28
  widgets = {
28
- "description": BBCodeEditorWidget(),
29
+ "description": get_editor_widget(),
29
30
  }
30
31
 
31
32
 
@@ -34,7 +35,7 @@ class SubcategoryAdminModelForm(forms.ModelForm):
34
35
  model = Subcategory
35
36
  fields = "__all__"
36
37
  widgets = {
37
- "description": BBCodeEditorWidget(),
38
+ "description": get_editor_widget(),
38
39
  }
39
40
 
40
41
 
@@ -43,7 +44,7 @@ class ThreadAdminModelForm(forms.ModelForm):
43
44
  model = Thread
44
45
  fields = "__all__"
45
46
  widgets = {
46
- "content": BBCodeEditorWidget(),
47
+ "content": get_editor_widget(),
47
48
  }
48
49
 
49
50
 
@@ -52,7 +53,7 @@ class PostAdminModelForm(forms.ModelForm):
52
53
  model = Post
53
54
  fields = "__all__"
54
55
  widgets = {
55
- "content": BBCodeEditorWidget(),
56
+ "content": get_editor_widget(),
56
57
  }
57
58
 
58
59
 
punkweb_bb/bbcode.py ADDED
@@ -0,0 +1,155 @@
1
+ import bbcode
2
+
3
+
4
+ def render_color(name, value, options, parent, context):
5
+ if "color" in options:
6
+ color = options["color"].strip()
7
+ return f'<span style="color: {color}">{value}</span>'
8
+ return value
9
+
10
+
11
+ def render_shadow(name, value, options, parent, context):
12
+ if "shadow" in options:
13
+ shadow = options["shadow"].strip()
14
+ return f'<span id="bbcode-shadow" style="text-shadow: 0px 0px 1em {shadow}">{value}</span>'
15
+ return value
16
+
17
+
18
+ def render_font(name, value, options, parent, context):
19
+ if "font" in options:
20
+ font = options["font"].strip()
21
+ return f'<span style="font-family:{font};">{value}</span>'
22
+ return value
23
+
24
+
25
+ def render_quote(name, value, options, parent, context):
26
+ if "quote" in options:
27
+ return f'<blockquote><cite>{options["quote"]} said: </cite>{value}</blockquote>'
28
+ return f"<blockquote>{value}</blockquote>"
29
+
30
+
31
+ def render_code(name, value, options, parent, context):
32
+ if "code" in options:
33
+ language = options["code"].strip()
34
+ return f'<pre><code class="language-{language}">{value}</code></pre>'
35
+ return f"<pre><code>{value}</code></pre>"
36
+
37
+
38
+ def render_img(name, value, options, parent, context):
39
+ if "width" in options:
40
+ width = options["width"]
41
+ if "height" in options:
42
+ height = options["height"]
43
+
44
+ if "width" in options and "height" in options:
45
+ return f'<img src="{value}" alt="{value}" width="{width}" height="{height}" />'
46
+ elif "width" in options:
47
+ return f'<img src="{value}" alt="{value}" width="{width}" />'
48
+ elif "height" in options:
49
+ return f'<img src="{value}" alt="{value}" height="{height}" />'
50
+
51
+ return f'<img src="{value}" alt="{value}" />'
52
+
53
+
54
+ def render_url(name, value, options, parent, context):
55
+ if "url" in options:
56
+ url = options["url"]
57
+ return f'<a href="{url}">{value}</a>'
58
+ return f'<a href="{value}">{value}</a>'
59
+
60
+
61
+ def render_size(name, value, options, parent, context):
62
+ if "size" in options:
63
+ size = options["size"].strip()
64
+ return f'<font size="{size}">{value}</font>'
65
+ return value
66
+
67
+
68
+ def init_default_tags(parser):
69
+ parser.add_simple_formatter("b", "<strong>%(value)s</strong>")
70
+ parser.add_simple_formatter("i", "<em>%(value)s</em>")
71
+ parser.add_simple_formatter("u", "<u>%(value)s</u>")
72
+ parser.add_simple_formatter("s", "<s>%(value)s</s>")
73
+ parser.add_simple_formatter("sub", "<sub>%(value)s</sub>")
74
+ parser.add_simple_formatter("sup", "<sup>%(value)s</sup>")
75
+ parser.add_simple_formatter("escape", "%(value)s", render_embedded=False)
76
+
77
+ parser.add_formatter("font", render_font)
78
+ parser.add_formatter("color", render_color)
79
+ parser.add_formatter("shadow", render_shadow)
80
+ parser.add_formatter("url", render_url, replace_links=False, replace_cosmetic=False)
81
+
82
+
83
+ _parser = None
84
+ _shoutbox_parser = None
85
+
86
+
87
+ def get_parser():
88
+ global _parser
89
+ if _parser is None:
90
+ _parser = bbcode.Parser(install_defaults=False)
91
+ init_default_tags(_parser)
92
+
93
+ _parser.add_simple_formatter("hr", "<hr />", standalone=True)
94
+ _parser.add_simple_formatter(
95
+ "center", '<div style="text-align: center">%(value)s</div>'
96
+ )
97
+ _parser.add_simple_formatter(
98
+ "left", '<div style="text-align: left">%(value)s</div>'
99
+ )
100
+ _parser.add_simple_formatter(
101
+ "right", '<div style="text-align: right">%(value)s</div>'
102
+ )
103
+ _parser.add_simple_formatter(
104
+ "ol",
105
+ "<ol>%(value)s</ol>",
106
+ transform_newlines=False,
107
+ strip=True,
108
+ swallow_trailing_newline=True,
109
+ )
110
+ _parser.add_simple_formatter(
111
+ "ul",
112
+ "<ul>%(value)s</ul>",
113
+ transform_newlines=False,
114
+ strip=True,
115
+ swallow_trailing_newline=True,
116
+ )
117
+ _parser.add_simple_formatter(
118
+ "li",
119
+ "<li>%(value)s</li>",
120
+ newline_closes=True,
121
+ transform_newlines=False,
122
+ same_tag_closes=True,
123
+ strip=True,
124
+ )
125
+
126
+ _parser.add_formatter("size", render_size)
127
+ _parser.add_formatter(
128
+ "img",
129
+ render_img,
130
+ render_embedded=False,
131
+ replace_links=False,
132
+ replace_cosmetic=False,
133
+ )
134
+ _parser.add_formatter(
135
+ "quote", render_quote, strip=True, swallow_trailing_newline=True
136
+ )
137
+ _parser.add_formatter(
138
+ "code",
139
+ render_code,
140
+ render_embedded=False,
141
+ transform_newlines=False,
142
+ replace_links=False,
143
+ replace_cosmetic=False,
144
+ strip=True,
145
+ swallow_trailing_newline=True,
146
+ )
147
+ return _parser
148
+
149
+
150
+ def get_shoutbox_parser():
151
+ global _shoutbox_parser
152
+ if _shoutbox_parser is None:
153
+ _shoutbox_parser = bbcode.Parser(install_defaults=False)
154
+ init_default_tags(_shoutbox_parser)
155
+ return _shoutbox_parser
punkweb_bb/forms.py CHANGED
@@ -2,7 +2,7 @@ from django import forms
2
2
  from django.contrib.auth.forms import AuthenticationForm, UserCreationForm
3
3
 
4
4
  from punkweb_bb.models import BoardProfile, Category, Post, Shout, Subcategory, Thread
5
- from punkweb_bb.widgets import BBCodeEditorWidget
5
+ from punkweb_bb.utils import get_editor_widget
6
6
 
7
7
 
8
8
  class LoginForm(AuthenticationForm):
@@ -39,7 +39,7 @@ class BoardProfileModelForm(forms.ModelForm):
39
39
  "signature",
40
40
  )
41
41
  widgets = {
42
- "signature": BBCodeEditorWidget(),
42
+ "signature": get_editor_widget(),
43
43
  }
44
44
 
45
45
 
@@ -66,7 +66,7 @@ class PostModelForm(forms.ModelForm):
66
66
  "content": "",
67
67
  }
68
68
  widgets = {
69
- "content": BBCodeEditorWidget(),
69
+ "content": get_editor_widget(),
70
70
  }
71
71
 
72
72
 
@@ -87,7 +87,7 @@ class SubcategoryModelForm(forms.ModelForm):
87
87
  )
88
88
  widgets = {
89
89
  "name": forms.TextInput(attrs={"autofocus": True, "class": "pw-input"}),
90
- "description": BBCodeEditorWidget(),
90
+ "description": get_editor_widget(),
91
91
  "order": forms.TextInput(
92
92
  attrs={"class": "pw-input", "min": "0", "type": "number"}
93
93
  ),
@@ -103,5 +103,13 @@ class ThreadModelForm(forms.ModelForm):
103
103
  )
104
104
  widgets = {
105
105
  "title": forms.TextInput(attrs={"autofocus": True, "class": "pw-input"}),
106
- "content": BBCodeEditorWidget(),
106
+ "content": get_editor_widget(),
107
107
  }
108
+
109
+
110
+ class ThreadMoveForm(forms.Form):
111
+ subcategory = forms.ModelChoiceField(
112
+ queryset=Subcategory.objects.all(),
113
+ empty_label="Select a subcategory",
114
+ widget=forms.Select(attrs={"class": "pw-input"}),
115
+ )
@@ -0,0 +1,24 @@
1
+ # Generated by Django 4.2.11 on 2024-05-30 02:25
2
+
3
+ from django.db import migrations
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ("punkweb_bb", "0004_groupstyle"),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.AlterModelOptions(
14
+ name="thread",
15
+ options={
16
+ "ordering": ("subcategory", "-is_pinned", "-last_post_created_at"),
17
+ "permissions": (
18
+ ("move_thread", "Can move thread"),
19
+ ("pin_thread", "Can pin thread"),
20
+ ("close_thread", "Can close thread"),
21
+ ),
22
+ },
23
+ ),
24
+ ]
@@ -0,0 +1,60 @@
1
+ # Generated by Django 4.2.11 on 2024-05-30 21:37
2
+
3
+ from django.db import migrations, models
4
+
5
+
6
+ class Migration(migrations.Migration):
7
+
8
+ dependencies = [
9
+ ("punkweb_bb", "0005_alter_thread_options"),
10
+ ]
11
+
12
+ operations = [
13
+ migrations.RemoveField(
14
+ model_name="boardprofile",
15
+ name="_signature_rendered",
16
+ ),
17
+ migrations.RemoveField(
18
+ model_name="groupstyle",
19
+ name="_username_style_rendered",
20
+ ),
21
+ migrations.RemoveField(
22
+ model_name="post",
23
+ name="_content_rendered",
24
+ ),
25
+ migrations.RemoveField(
26
+ model_name="subcategory",
27
+ name="_description_rendered",
28
+ ),
29
+ migrations.RemoveField(
30
+ model_name="thread",
31
+ name="_content_rendered",
32
+ ),
33
+ migrations.AlterField(
34
+ model_name="boardprofile",
35
+ name="signature",
36
+ field=models.TextField(blank=True, default="", max_length=1024),
37
+ preserve_default=False,
38
+ ),
39
+ migrations.AlterField(
40
+ model_name="groupstyle",
41
+ name="username_style",
42
+ field=models.TextField(),
43
+ ),
44
+ migrations.AlterField(
45
+ model_name="post",
46
+ name="content",
47
+ field=models.TextField(),
48
+ ),
49
+ migrations.AlterField(
50
+ model_name="subcategory",
51
+ name="description",
52
+ field=models.TextField(blank=True, default=""),
53
+ preserve_default=False,
54
+ ),
55
+ migrations.AlterField(
56
+ model_name="thread",
57
+ name="content",
58
+ field=models.TextField(),
59
+ ),
60
+ ]
punkweb_bb/models.py CHANGED
@@ -8,7 +8,6 @@ from django.db import models
8
8
  from django.forms import ValidationError
9
9
  from django.urls import reverse
10
10
  from django.utils import timezone
11
- from precise_bbcode.fields import BBCodeTextField
12
11
 
13
12
  from punkweb_bb.mixins import TimestampMixin, UUIDPrimaryKeyMixin
14
13
  from punkweb_bb.utils import get_highest_priority_group, get_styled_username
@@ -24,7 +23,7 @@ def profile_image_upload_to(instance, filename):
24
23
  class BoardProfile(UUIDPrimaryKeyMixin, TimestampMixin):
25
24
  user = models.OneToOneField(User, related_name="profile", on_delete=models.CASCADE)
26
25
  image = models.ImageField(upload_to=profile_image_upload_to, blank=True, null=True)
27
- signature = BBCodeTextField(max_length=1024, blank=True, null=True)
26
+ signature = models.TextField(max_length=1024, blank=True)
28
27
 
29
28
  class Meta:
30
29
  ordering = ("user__username",)
@@ -76,7 +75,7 @@ class Subcategory(UUIDPrimaryKeyMixin, TimestampMixin):
76
75
  )
77
76
  name = models.CharField(max_length=255)
78
77
  slug = models.SlugField(max_length=1024, unique=True)
79
- description = BBCodeTextField(blank=True, null=True)
78
+ description = models.TextField(blank=True)
80
79
  order = models.PositiveIntegerField(default=0)
81
80
  staff_post_only = models.BooleanField(default=False)
82
81
 
@@ -116,7 +115,7 @@ class Thread(UUIDPrimaryKeyMixin, TimestampMixin):
116
115
  )
117
116
  user = models.ForeignKey(User, related_name="threads", on_delete=models.CASCADE)
118
117
  title = models.CharField(max_length=255)
119
- content = BBCodeTextField()
118
+ content = models.TextField()
120
119
  is_pinned = models.BooleanField(default=False)
121
120
  is_closed = models.BooleanField(default=False)
122
121
  last_post_created_at = models.DateTimeField(auto_now_add=True)
@@ -129,6 +128,7 @@ class Thread(UUIDPrimaryKeyMixin, TimestampMixin):
129
128
  "-last_post_created_at",
130
129
  )
131
130
  permissions = (
131
+ ("move_thread", "Can move thread"),
132
132
  ("pin_thread", "Can pin thread"),
133
133
  ("close_thread", "Can close thread"),
134
134
  )
@@ -160,7 +160,7 @@ class Thread(UUIDPrimaryKeyMixin, TimestampMixin):
160
160
  class Post(UUIDPrimaryKeyMixin, TimestampMixin):
161
161
  thread = models.ForeignKey(Thread, related_name="posts", on_delete=models.CASCADE)
162
162
  user = models.ForeignKey(User, related_name="posts", on_delete=models.CASCADE)
163
- content = BBCodeTextField()
163
+ content = models.TextField()
164
164
 
165
165
  class Meta:
166
166
  ordering = ("created_at",)
@@ -222,7 +222,7 @@ class GroupStyle(UUIDPrimaryKeyMixin, TimestampMixin):
222
222
  default=0,
223
223
  help_text="Highest priority is displayed",
224
224
  )
225
- username_style = BBCodeTextField()
225
+ username_style = models.TextField()
226
226
 
227
227
  class Meta:
228
228
  ordering = ("-priority",)
punkweb_bb/settings.py CHANGED
@@ -4,6 +4,7 @@ PUNKWEB_BB = getattr(settings, "PUNKWEB_BB", {})
4
4
 
5
5
  SITE_NAME = PUNKWEB_BB.get("SITE_NAME", "PUNKWEB")
6
6
  SITE_TITLE = PUNKWEB_BB.get("SITE_TITLE", "PunkwebBB")
7
+ PARSER = PUNKWEB_BB.get("PARSER", "bbcode")
7
8
  FAVICON = PUNKWEB_BB.get("FAVICON", "punkweb_bb/favicon.ico")
8
9
  OG_IMAGE = PUNKWEB_BB.get("OG_IMAGE", None)
9
10
  SHOUTBOX_ENABLED = PUNKWEB_BB.get("SHOUTBOX_ENABLED", True)
@@ -1,7 +1,5 @@
1
1
  * {
2
2
  box-sizing: border-box;
3
- margin: 0;
4
- padding: 0;
5
3
  }
6
4
 
7
5
  *:before,
@@ -13,6 +11,8 @@
13
11
  body {
14
12
  line-height: 1;
15
13
  min-width: 20rem;
14
+ margin: 0;
15
+ padding: 0;
16
16
  }
17
17
 
18
18
  /* set cursor to pointer on buttons */
@@ -4,6 +4,7 @@
4
4
  display: flex;
5
5
  flex-direction: column;
6
6
  justify-content: center;
7
+ padding: 2rem;
7
8
 
8
9
  position: fixed;
9
10
  top: 0;
@@ -28,6 +29,7 @@
28
29
  border-radius: 0.25rem;
29
30
  box-shadow: 0 0.5rem 1rem 0 rgba(0, 0, 0, 0.25);
30
31
  background-color: white;
32
+ overflow: auto;
31
33
  position: relative;
32
34
  width: fit-content;
33
35
 
@@ -181,7 +181,7 @@ blockquote cite {
181
181
  border-bottom: 1px solid var(--border);
182
182
  color: var(--table-header-text);
183
183
  font-size: 0.875rem;
184
- font-weight: 500;
184
+ font-weight: 700;
185
185
  padding: 0.75rem 1rem;
186
186
  text-align: left;
187
187
  }
@@ -664,7 +664,7 @@ blockquote cite {
664
664
  .pw-input-label {
665
665
  display: block;
666
666
  font-size: 0.875rem;
667
- font-weight: 500;
667
+ font-weight: 700;
668
668
  }
669
669
 
670
670
  /** Card **/
@@ -11,6 +11,10 @@
11
11
  gap: 1rem;
12
12
  }
13
13
 
14
+ .subcategory__header__name h1 {
15
+ margin: 0;
16
+ }
17
+
14
18
  .subcategory__header__actions {
15
19
  align-items: center;
16
20
  display: flex;
@@ -97,6 +97,30 @@
97
97
  gap: 1rem;
98
98
  }
99
99
 
100
+ .threadMoveForm {
101
+ display: flex;
102
+ flex-direction: column;
103
+ gap: 1rem;
104
+ }
105
+
106
+ .threadMoveForm__field {
107
+ display: flex;
108
+ flex-direction: column;
109
+ gap: 0.5rem;
110
+ }
111
+
112
+ .threadMoveForm .errorlist {
113
+ color: var(--oc-red-9);
114
+ margin: 0;
115
+ }
116
+
117
+ .threadMoveForm__actions {
118
+ align-items: center;
119
+ display: flex;
120
+ justify-content: flex-end;
121
+ gap: 1rem;
122
+ }
123
+
100
124
  @media screen and (max-width: 1024px) {
101
125
  .thread {
102
126
  flex-direction: column;
@@ -8,12 +8,16 @@ body {
8
8
  line-height: 1.5;
9
9
  overflow: visible;
10
10
  }
11
+
11
12
  html {
12
13
  height: 100%;
13
14
  }
14
15
 
15
16
  * {
16
17
  box-sizing: border-box;
18
+ }
19
+
20
+ body {
17
21
  margin: 0;
18
22
  padding: 0;
19
23
  }
@@ -56,11 +60,6 @@ a {
56
60
  text-decoration: none;
57
61
  }
58
62
 
59
- ul,
60
- ol {
61
- padding-inline-start: 2rem;
62
- }
63
-
64
63
  code {
65
64
  display: block;
66
65
  background: #f5f2f0;
@@ -1,12 +1,7 @@
1
1
  $(function () {
2
2
  $(document).ready(function () {
3
3
  $(".bbcode-editor").sceditor({
4
- emoticonsCompat: true,
5
4
  emoticonsEnabled: false,
6
- emoticonsRoot: "/media/precise_bbcode/smilies/",
7
- emoticons: {
8
- dropdown: {},
9
- },
10
5
  format: "bbcode",
11
6
  icons: "material",
12
7
  style: "/static/punkweb_bb/editor/bbcode-editor-content.css",
@@ -0,0 +1,49 @@
1
+ function initMarkdownEditor(containerElement) {
2
+ var editorElement = containerElement.querySelector(".markdown-editor");
3
+ var toolbarElement = containerElement.querySelector(
4
+ "#markdown-editor-toolbar"
5
+ );
6
+
7
+ var editor = null;
8
+
9
+ if (!containerElement.querySelector(".TinyMDE")) {
10
+ editor = new TinyMDE.Editor({
11
+ textarea: editorElement,
12
+ });
13
+ }
14
+
15
+ if (editor && !toolbarElement.querySelector(".TMCommandBar")) {
16
+ var toolbar = new TinyMDE.CommandBar({
17
+ element: toolbarElement,
18
+ editor: editor,
19
+ commands: [
20
+ "bold",
21
+ "italic",
22
+ "strikethrough",
23
+ "|",
24
+ "h1",
25
+ "h2",
26
+ "|",
27
+ "ul",
28
+ "ol",
29
+ "|",
30
+ "blockquote",
31
+ "code",
32
+ "insertLink",
33
+ "insertImage",
34
+ "hr",
35
+ ],
36
+ });
37
+ }
38
+ }
39
+
40
+ $(function () {
41
+ $(document).ready(function () {
42
+ var editorElements = document.querySelectorAll(
43
+ ".markdown-editor-container"
44
+ );
45
+ editorElements.forEach((element) => {
46
+ initMarkdownEditor(element);
47
+ });
48
+ });
49
+ });