75 Commits

Author SHA1 Message Date
ca33838a21 Code style fixes 2024-10-08 12:24:10 +02:00
c27979bdf4 🤖 Automatic code style fixes 2024-10-08 08:53:15 +00:00
d5f7546e5b Upgrade tests 2022-10-19 11:39:12 +02:00
e339915732 🐛 Fix crash for listitems without content
If a listitem has no content, then parsing that empty listitem back
into syntax caused a crash. This is now fixed, prevented and tested.

The trade-off is that syntax
  * <code>foo</code>
has now an extra linebreak in front of the code block.

See sentry issues WIKI-A1, WIKI-9G, WIKI-A2, WIKI-9H, WIKI-A0 ...
2018-10-17 16:11:59 +02:00
e50c05b7c6 Implement ~~NOCACHE~~ and ~~NOTOC~~
These macros have no visual representation in the xhtml rendered by
DokuWiki and thus should not be rendered in the prosemirror editor
either.

Attaching this to the root not seems to be cleanest approach. However,
this has some challenges, because by default the attributes on the doc
node cannot be edited because, currently, prosemirror transformations
only apply to the _content_ of the document. However, marijn
indicated[0] that it might be worth adding a step for this to the
official packages.
We are here using a custom step that was provided in another thread[1]
on the official form that does exactly that: setting attributes on the
doc node.

However, these macros make only sense on a top-level page, not in
footnotes. Thus, they are removed from that schema. Something similar
would likely have to be done for a schema for the wrap-plugin or other
similar plugins.

Also, I think checkboxes are the best way to go for representing
toggeling of options. Thus, I added them with a render function and
hide/show them during the update() step. The background is that the
render function is only run during the initialisation and later only
updated via the update() method. See the MenuView class and the called
methods in MenuItem.

Further, the macros themselves are not rendered in the HTML, but the
spaces and linebreaks may still generate instructions for an more or
less empty paragraph. To ensure consistent spacing in the syntax
between the blocks, I've added the rtrim call in the RootNode. Thus
all blocks in the syntax should now always be separated by exactly one
empty line.

[0] https://discuss.prosemirror.net/t/meta-data-nodes/1163/6
[1] https://discuss.prosemirror.net/t/changing-doc-attrs/784/17
2018-09-18 16:06:11 +02:00
d64ad16f7a 🎨 Explicitly declare method visibility 2018-09-17 15:50:57 +02:00
d75b41a510 ♻️ (Tables) Remove some duplicate render code for table cells/headers 2018-09-03 14:15:49 +02:00
e38ce63087 🐛 (Tables) Allow some blocks in table cells
This fixes two things:

1. DokuWiki allows for some blocks in table cells, i.e. protected and
substitution. Since we cannot mix blocks and inline content in
Prosemirror, we have to allow only block-nodes within table cells and
hence must start with a paragraph to support simple text.

When allowing for paragraphs we have to guard our trimming statement
because `ltrim(null)` is apparently an empty string.

2. The splitCell command from prosemirror-tables module implicitly expects to
be called from within a block element in a table cell. Because their
cellWrapping utlility function starts at looking for the table cell at
`pos.depth - 1` which is the table row if the cell only contains inline
content. See also ProseMirror/prosemirror-tables#59 for this.
2018-09-03 14:03:12 +02:00
15703606fa 🐛 Trim whitespace in table cells 2018-08-31 18:07:01 +02:00
d4f7c82840 Add menu buttons to align cell content
trimming the content in the dom is still missing
2018-08-31 18:06:44 +02:00
a2dc9ec83a Add menu button to toggle table headers 2018-08-29 16:32:34 +02:00
578b049520 Add support for footnotes
Closes #20
2018-07-19 13:38:58 +02:00
82e39f2b91 🚸 Ensure there is always initially an open paragraph on an empty page
This should also resolve #52, even though I couldn't reproduce it.
2018-07-16 12:38:11 +02:00
a4aeaad6a2 Add support for DokuWiki's smiley replacement
Closes #48
2018-07-13 10:42:01 +02:00
a16a8f7802 Add support for RSS syntax
This uses the new KeyValueForm
2018-07-12 19:02:54 +02:00
bee1441cc2 add support for external plugin integration
This includes a generic key-value form.
A reference implementation will be done for the gallery plugin.

Implements most of issue #50
2018-07-12 15:51:44 +02:00
5fd1e0a07c 🔥 Treat <file> syntax as <code>
They are mostly equivalent and this simplifies things.
2018-06-29 15:59:23 +02:00
7615f387e7 🐛 Use built-in type quotes 2018-06-11 15:35:07 +02:00
3a35522d5b 🐛 Go back to implementing lists with <p>
The previous approach didn't work.

Using a list_paragraph inside of the li failed, because then Prosemirror
would no longer wrap ordinary paragraphs in list items.
Using an ordinary paragraph inside of a list item wouldn't work because
than splitting list items with the Enter-key breaks because it only
splits list items if one is in the direct descendant of the list_item.

Hence, using paragraphs directly in the list item and fixing styles via
css.
2018-06-11 12:39:57 +02:00
85f6b8e96e 🐛 fix syntax allowed in list nodes
This fixes the problem that headlines and quoting was possible in list
nodes. To achieve this we build list nodes closer to how they are in
dokuwiki. They must now contain one list_content node and may contain
one bullet_list or ordered_list node. The list_content node may contain
a list_paragraph (it's just like an ordinary paragraph, except that it
is rendered in `<div>` instead of `<p>` tags to prevent extra styling)
or nodes from the group protected_block or substitution_block. The
groups are created analogous to the PARSER_MODES in DokuWiki, except
that we have to differentiate between block and inline nodes.

This should fix two more items mentioned in #28
2018-06-06 12:58:25 +02:00
a620d01b88 🏗️ Split plugin type into block/inline subtypes 2018-06-04 14:44:35 +02:00
68e15a335d style: mostly automatic code fixes 2018-05-02 13:27:58 +02:00
93e65885ad style: whitespace changes by idea
These kept leaking into other commits, so here is one big change in hope
of reducing future noise.
2018-02-08 17:32:01 +01:00
29575d3535 feat: add support for RSS
This creates uneditable syntax, but at least the RSS neither breaks nor
disappers. We will need a specific RSS editor.
2018-02-05 16:47:19 +01:00
2499888d1c fix: stop mixing inline and block content in lists
DokuWiki currently mixes inline and block content in list items. While
HTML allows for this, ProseMirror does not.
2018-02-05 15:47:33 +01:00
30c5a2dd4e feat: add support for smileys
Currently, they are treated as common text. Later we should add an
toolbar button, actually render them as images and add an input macro
that replaces the typed text with the image.
2018-02-05 14:39:47 +01:00
73e43840ef feat: add support for html and php 2018-02-05 13:37:49 +01:00
6e3a8700be feat: add options for code and support for <file> 2018-02-02 17:12:35 +01:00
038fb1f500 refactor: move link rendering to parser nodes
As with parsing, lots of link rendering as much overlap between the
different link types. Moving this to their respective parser classes
bundles related code at one place.
2018-01-31 13:25:40 +01:00
8fd5d90118 refactor: extract abstract LinkNode class
The link nodes have large parts of identical functionality so it makes
sense to extract a common parent class.

This also extended the ImageNode class to correctly implement the
InlineNode interface as it is an inline node,
2018-01-30 18:08:32 +01:00
24c6eb7d72 fix: only trim newlines form start of code blocks 2018-01-30 15:04:14 +01:00
92a5ea435b fix: add handling for windows share links 2018-01-30 15:04:01 +01:00
e20facdaa8 feat: add support for external images 2018-01-30 13:54:32 +01:00
5702b4a5de refactor: move image rendering to parser\ImageNode 2018-01-30 13:53:31 +01:00
97b8599186 fix: add better handling for plugin node
Now parsing for plugins works. Also, plugin nodes can now only contain a
single text node, which means that marks can now only be applied to the
entire node instead incorrectly to parts of it.
2018-01-30 12:09:55 +01:00
88ac3db2df Merge branch 'master' into addPluginNodeType 2018-01-29 17:30:04 +01:00
b8a28b01e1 fix: render paragraphs inside of quotes
Prosemirror cannot allow both inline and block content in the same node.
Hence we have to render a paragraph before rendering the text of a
quote.
2018-01-29 17:27:59 +01:00
6212b34044 refactor: clean up plugin rendering method 2018-01-29 16:52:33 +01:00
674625115d Merge branch 'master' into addPluginNodeType 2018-01-29 16:49:46 +01:00
063ce30e6e feat: add support for quotes 2018-01-29 15:51:56 +01:00
ea31cc0bac feat: add handling for emaillinks 2018-01-29 15:26:17 +01:00
ad2728f929 feat: add support for nowiki syntax 2018-01-29 14:58:12 +01:00
cd0b5d42c4 fix: keep relative links as they are 2018-01-29 14:00:14 +01:00
a979e5c48c feat: add temporary rudimentary footnote support
This is very much not done yet, but at least it doesn't break anymore
when editing a page with footnotes. However footnotes cannot properly be
removed or added and they do appear inline.
2018-01-25 15:45:52 +01:00
960aa236d7 feat: handle images in extenallink nodes 2018-01-25 15:28:03 +01:00
ea1e28e639 feat: parse explicit line breaks, i.e. \\
For this to work correctly we have to remove normal linebreaks from
paragraph syntax.
2018-01-25 11:35:11 +01:00
ef9123af6b feat: separate preformatted and code block nodes 2018-01-23 13:36:27 +01:00
fbeb684547 feat: add locallink node 2018-01-23 12:03:12 +01:00
59e304f02a feat: Add external link node
Links are complex enough that they need their own types.
2018-01-23 11:13:56 +01:00
69209cd059 feat: add parsing for images and imagelinks 2017-12-12 16:55:05 +01:00