cosmocode / dokuwiki-plugin-prosemirror

A modern WYSIWYG editor for DokuWiki
https://wysiwyg.wiki.cosmocode.de/
54 stars 20 forks source link
dokuwiki dokuwiki-plugin javascript php wysiwyg-editor

prosemirror Plugin for DokuWiki

Scrutinizer Code Quality

A WYSIWYG editor for DokuWiki

All documentation for this plugin can be found at https://www.dokuwiki.org/plugin:prosemirror

If you install this plugin manually, make sure it is installed in lib/plugins/prosemirror/ - if the folder is called different it will not work!

Please refer to http://www.dokuwiki.org/plugins for additional info on how to install plugins in DokuWiki.

Development Setup

Use yarn to install the dependecies

yarn

Create a develoment bundle:

yarn dev

Automatically recreate the bundle during development:

yarn watch

Build a release

yarn build

We really recommend yarn, but npm should work, too.

Architecture

Dataflow

Begin Edit-Session: DokuWiki -> Prosemirror

Rendering: Prosemirror -> DokuWiki -> Prosemirror

Saving/Preview: Prosemirror -> DokuWiki

Our Prosemirror JS setup

Currently all our prosemirror scripts are in script/. This definietly needs some better organisation. I can see the following possible groups:

These files are compiled with webpack and transpiled with Babel into lib/bundle.js, which is the file actually included by DokuWiki.

Testing

The central test-data is the collection of DokuWiki-Syntax and corresponding Prosemirror JSON in _test/json/. This data is used for three sets of tests:

  1. Testing the rendering of DokuWiki-Syntax to Prosemirror JSON in _test/renderer.test.php
  2. Testing the parsing of Prosemirror JSON back to the original DokuWiki-Syntax in _test/jsonParser.test.php
  3. Testing the validity of the Prosemirror JSON against the schema (script/schema.js) in _jstest/test.js

The rendering and parsing tests are run as usual DokuWiki tests. The javascript tests are run with yarn test

The scripts in script/ are also checked when building with eslint. Eslint can also be run on its own with yarn eslint.

Copyright

Copyright (C) CosmoCode GmbH dokuwiki@cosmocode.de Andreas Gohr Michael Grosse Anna Dabrowska

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

See the COPYING file in your DokuWiki folder for details