Skip to content

Commit

Permalink
Various fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed Mar 15, 2024
1 parent 3478a72 commit b1f3cfe
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Change log
Next version
~~~~~~~~~~~~

- Made the editor usable in dark mode.
- Changed the cancel buttons in dialogs to not validate the form.


0.2 (2024-03-12)
~~~~~~~~~~~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion django_prose_editor/static/django_prose_editor/editor.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions django_prose_editor/static/django_prose_editor/editor.js

Large diffs are not rendered by default.

14 changes: 12 additions & 2 deletions src/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const linkDialog = (attrs) => {
<p><label>URL</label> <input type="url" name="href" size="50" required></p>
<p><label>Title</label> <input type="text" name="title" size="50"></p>
<button type="submit">Update</button>
<button value="cancel" formmethod="dialog">Cancel</button>
<button type="button" value="cancel">Cancel</button>
</form>
</dialog>
`
Expand All @@ -20,6 +20,11 @@ const linkDialog = (attrs) => {
form.href.value = attrs.href || ""
form.title.value = attrs.title || ""

dialog
.querySelector("button[value=cancel]")
.addEventListener("click", () => {
dialog.close()
})
dialog.addEventListener("close", () => {
div.remove()
resolve(null)
Expand Down Expand Up @@ -91,7 +96,7 @@ const htmlDialog = (html) => {
<form>
<p><textarea name="html" cols="80" rows="30"></textarea></p>
<button type="submit">Update</button>
<button value="cancel" formmethod="dialog">Cancel</button>
<button type="button" value="cancel">Cancel</button>
</form>
</dialog>
`
Expand All @@ -100,6 +105,11 @@ const htmlDialog = (html) => {
const form = div.querySelector("form")
form.html.value = html

dialog
.querySelector("button[value=cancel]")
.addEventListener("click", () => {
dialog.close()
})
dialog.addEventListener("close", () => {
div.remove()
resolve(null)
Expand Down
4 changes: 3 additions & 1 deletion src/editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

.prose-menubar {
font-size: 14px;
background: white;
background: var(--body-bg);
display: inline-flex;
gap: 8px;
flex-wrap: wrap;
Expand Down Expand Up @@ -89,6 +89,8 @@

/* dialog */
.prose-editor-dialog {
background: var(--body-bg);
color: var(--body-fg);
border: 1px solid var(--border-color);
}

Expand Down
2 changes: 1 addition & 1 deletion src/overrides.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}

.ProseMirror * {
color: black !important;
color: var(--body-fg) !important;
}

.ProseMirror p {
Expand Down

0 comments on commit b1f3cfe

Please sign in to comment.