Skip to content

Commit 143020c

Browse files
committed
fix: issue #156, editor in fullscreen mode, added tox, etc.
1 parent fcb44cb commit 143020c

File tree

10 files changed

+35
-7
lines changed

10 files changed

+35
-7
lines changed

martor/static/martor/css/martor-admin.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ nav.sticky caption {
8989
fieldset .form-row>div {
9090
width: 100%;
9191
}
92-
fieldset .form-row div>label {
93-
display: contents!important;
92+
fieldset .form-row .main-martor {
93+
display: grid!important;
9494
}
9595

9696
.submit-row a.deletelink {

martor/static/martor/css/martor-admin.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

martor/static/martor/css/martor.bootstrap.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,10 @@ div.enable-living .tab-martor-menu a.nav-link {
178178
height: 90%;
179179
position: relative;
180180
}
181+
.main-martor-fullscreen .martor-field,
182+
.main-martor-fullscreen div.martor-preview {
183+
min-height: 95vh
184+
}
181185

182186
/* Preview */
183187
.marked-emoji,

martor/static/martor/css/martor.bootstrap.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

martor/static/martor/css/martor.semantic.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ body.overflow {
7676
height: 90%;
7777
position: relative;
7878
}
79+
.main-martor-fullscreen .martor-field,
80+
.main-martor-fullscreen .martor-preview {
81+
min-height: 95vh
82+
}
7983
/* EOF */
8084

8185
.marked-emoji,

martor/static/martor/css/martor.semantic.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

martor_demo/app/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class PostMetaAdminInline(admin.TabularInline):
1212

1313

1414
class PostAdmin(admin.ModelAdmin):
15-
inlines = [PostMetaAdminInline,]
15+
inlines = [PostMetaAdminInline, ]
1616
list_display = ['title', 'id']
1717
formfield_overrides = {
1818
MartorField: {'widget': AdminMartorWidget},

martor_demo/app/models.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
11
from django.db import models
2+
from django.contrib.auth import get_user_model
3+
24
from martor.models import MartorField
35

6+
User = get_user_model()
7+
48

59
class Post(models.Model):
10+
author = models.ForeignKey(User, on_delete=models.CASCADE,
11+
blank=True, null=True)
612
title = models.CharField(max_length=200)
713
description = MartorField()
814
wiki = MartorField(blank=True)
915

16+
def __str__(self):
17+
return self.title
18+
1019

1120
class PostMeta(models.Model):
1221
post = models.ForeignKey(Post, on_delete=models.CASCADE)
1322
text = MartorField()
23+
24+
def __str__(self):
25+
return self.text

martor_demo/app/views.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ def post_form_view(request):
2323
if request.method == 'POST':
2424
form = PostForm(request.POST)
2525
if form.is_valid():
26-
post = form.save()
26+
post = form.save(commit=False)
27+
post.author = request.user
28+
post.save()
2729
messages.success(request, '%s successfully saved.' % post.title)
2830
return redirect('test_markdownify')
2931
else:

tox.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[flake8]
2+
ignore = E226,E302,E41,E402,E501,W504,E731,E741,F403
3+
exclude = .cache, .pytest_cache, .git, .tox, build, dist,
4+
*migrations*, .etc, .github, locale, *backup*,
5+
templates, static, media, urls.py
6+
max-line-length = 120

0 commit comments

Comments
 (0)