yafowil.widget.tiptap 2.0.0__tar.gz
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.
- yafowil_widget_tiptap-2.0.0/.gitignore +20 -0
- yafowil_widget_tiptap-2.0.0/CHANGES.rst +33 -0
- yafowil_widget_tiptap-2.0.0/LICENSE.rst +26 -0
- yafowil_widget_tiptap-2.0.0/PKG-INFO +63 -0
- yafowil_widget_tiptap-2.0.0/README.rst +40 -0
- yafowil_widget_tiptap-2.0.0/pyproject.toml +69 -0
- yafowil_widget_tiptap-2.0.0/src/yafowil/widget/tiptap/__init__.py +145 -0
- yafowil_widget_tiptap-2.0.0/src/yafowil/widget/tiptap/example.py +226 -0
- yafowil_widget_tiptap-2.0.0/src/yafowil/widget/tiptap/resources/bootstrap5/widget.js +749 -0
- yafowil_widget_tiptap-2.0.0/src/yafowil/widget/tiptap/resources/bootstrap5/widget.min.css +1 -0
- yafowil_widget_tiptap-2.0.0/src/yafowil/widget/tiptap/resources/bootstrap5/widget.min.js +1 -0
- yafowil_widget_tiptap-2.0.0/src/yafowil/widget/tiptap/resources/default/widget.js +756 -0
- yafowil_widget_tiptap-2.0.0/src/yafowil/widget/tiptap/resources/default/widget.min.css +1 -0
- yafowil_widget_tiptap-2.0.0/src/yafowil/widget/tiptap/resources/default/widget.min.js +1 -0
- yafowil_widget_tiptap-2.0.0/src/yafowil/widget/tiptap/resources/tiptap/tiptap.dist.bundle.js +22314 -0
- yafowil_widget_tiptap-2.0.0/src/yafowil/widget/tiptap/resources/tiptap/tiptap.js +17581 -0
- yafowil_widget_tiptap-2.0.0/src/yafowil/widget/tiptap/resources/tiptap/tiptap.min.js +1 -0
- yafowil_widget_tiptap-2.0.0/src/yafowil/widget/tiptap/tests/test_widget.py +168 -0
- yafowil_widget_tiptap-2.0.0/src/yafowil/widget/tiptap/widget.py +125 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
*.egg-info
|
|
2
|
+
*.pyc
|
|
3
|
+
*.pyo
|
|
4
|
+
/.coverage
|
|
5
|
+
/.mxmake/
|
|
6
|
+
/build
|
|
7
|
+
/constraints-mxdev.txt
|
|
8
|
+
/coverage/
|
|
9
|
+
/dist/
|
|
10
|
+
/htmlcov/
|
|
11
|
+
/js/karma/
|
|
12
|
+
/node_modules/
|
|
13
|
+
/package-lock.json
|
|
14
|
+
/pnpm-lock.yaml
|
|
15
|
+
/py2/
|
|
16
|
+
/py3/
|
|
17
|
+
/pypy3/
|
|
18
|
+
/requirements-mxdev.txt
|
|
19
|
+
/sources/
|
|
20
|
+
/venv/
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Changes
|
|
2
|
+
=======
|
|
3
|
+
|
|
4
|
+
2.0.0 (2026-02-03)
|
|
5
|
+
------------------
|
|
6
|
+
|
|
7
|
+
- Refactor package layout to use ``pyproject.toml`` and implicit namespace packages.
|
|
8
|
+
[rnix]
|
|
9
|
+
|
|
10
|
+
- Introduce ``display_class`` widget property.
|
|
11
|
+
[lenadax]
|
|
12
|
+
|
|
13
|
+
- Update jQuery to version ``4.0.0-beta.2``.
|
|
14
|
+
[lenadax]
|
|
15
|
+
|
|
16
|
+
- Use rollup for bundling scss. Use ``make rollup`` to compile js and scss.
|
|
17
|
+
[lenadax]
|
|
18
|
+
|
|
19
|
+
- Use ``webtestrunner`` instead of ``karma`` for js tests. Use ``make wtr`` to run tests.
|
|
20
|
+
[lenadax]
|
|
21
|
+
|
|
22
|
+
- Use ``pnpm`` as package manager.
|
|
23
|
+
[lenadax]
|
|
24
|
+
|
|
25
|
+
- Create Bootstrap5 widget version.
|
|
26
|
+
[lenadax]
|
|
27
|
+
|
|
28
|
+
- Extend JS by ``tiptap_on_array_add`` and ``register_array_subscribers``
|
|
29
|
+
functions to enable usage in ``yafowil.widget.array``.
|
|
30
|
+
[lenadax]
|
|
31
|
+
|
|
32
|
+
- Make it work.
|
|
33
|
+
[lenadax]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
License
|
|
2
|
+
=======
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2021-2025, Yafowil Contributors
|
|
5
|
+
All rights reserved.
|
|
6
|
+
|
|
7
|
+
Redistribution and use in source and binary forms, with or without
|
|
8
|
+
modification, are permitted provided that the following conditions are met:
|
|
9
|
+
|
|
10
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
11
|
+
list of conditions and the following disclaimer.
|
|
12
|
+
|
|
13
|
+
* Redistributions in binary form must reproduce the above copyright notice, this
|
|
14
|
+
list of conditions and the following disclaimer in the documentation and/or
|
|
15
|
+
other materials provided with the distribution.
|
|
16
|
+
|
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
18
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
19
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
20
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
|
21
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
22
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
23
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
24
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
25
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
26
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: yafowil.widget.tiptap
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Tiptap Editor Widget for YAFOWIL
|
|
5
|
+
Author-email: Yafowil Contributors <dev@conestack.org>
|
|
6
|
+
License: Simplified BSD
|
|
7
|
+
License-File: LICENSE.rst
|
|
8
|
+
Classifier: Environment :: Web Environment
|
|
9
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Programming Language :: Python
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
18
|
+
Requires-Dist: yafowil>3.99
|
|
19
|
+
Provides-Extra: test
|
|
20
|
+
Requires-Dist: lxml; extra == 'test'
|
|
21
|
+
Requires-Dist: pytest; extra == 'test'
|
|
22
|
+
Description-Content-Type: text/x-rst
|
|
23
|
+
|
|
24
|
+
.. image:: https://img.shields.io/pypi/v/yafowil.widget.tiptap.svg
|
|
25
|
+
:target: https://pypi.python.org/pypi/yafowil.widget.tiptap
|
|
26
|
+
:alt: Latest PyPI version
|
|
27
|
+
|
|
28
|
+
.. image:: https://img.shields.io/pypi/dm/yafowil.widget.tiptap.svg
|
|
29
|
+
:target: https://pypi.python.org/pypi/yafowil.widget.tiptap
|
|
30
|
+
:alt: Number of PyPI downloads
|
|
31
|
+
|
|
32
|
+
.. image:: https://github.com/conestack/yafowil.widget.tiptap/actions/workflows/test_py.yaml/badge.svg
|
|
33
|
+
:target: https://github.com/conestack/yafowil.widget.tiptap/actions/workflows/test_py.yaml
|
|
34
|
+
:alt: Test yafowil.widget.tiptap Python
|
|
35
|
+
|
|
36
|
+
.. image:: https://github.com/conestack/yafowil.widget.tiptap/actions/workflows/test_js.yaml/badge.svg
|
|
37
|
+
:target: https://github.com/conestack/yafowil.widget.tiptap/actions/workflows/test_js.yaml
|
|
38
|
+
:alt: Test yafowil.widget.tiptap JS
|
|
39
|
+
|
|
40
|
+
This is a **tiptap editor widget** for `YAFOWIL
|
|
41
|
+
<http://pypi.python.org/pypi/yafowil>`_
|
|
42
|
+
|
|
43
|
+
- `Tiptap Editor <https://github.com/ueberdosis/tiptap>`_
|
|
44
|
+
- `DEMO - see it Live <http://demo.yafowil.info/++widget++yafowil.widget.tiptap/index.html>`_
|
|
45
|
+
|
|
46
|
+
Currently included version of tiptap editor is 2.0.0-beta.166.
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
Source Code
|
|
50
|
+
===========
|
|
51
|
+
|
|
52
|
+
The sources are in a GIT DVCS with its main branches at
|
|
53
|
+
`github <http://github.com/conestack/yafowil.widget.tiptap>`_.
|
|
54
|
+
|
|
55
|
+
We'd be happy to see many forks and pull-requests to make YAFOWIL even better.
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
Contributors
|
|
59
|
+
============
|
|
60
|
+
|
|
61
|
+
- Robert Niederreiter
|
|
62
|
+
|
|
63
|
+
- Lena Daxenbichler
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
.. image:: https://img.shields.io/pypi/v/yafowil.widget.tiptap.svg
|
|
2
|
+
:target: https://pypi.python.org/pypi/yafowil.widget.tiptap
|
|
3
|
+
:alt: Latest PyPI version
|
|
4
|
+
|
|
5
|
+
.. image:: https://img.shields.io/pypi/dm/yafowil.widget.tiptap.svg
|
|
6
|
+
:target: https://pypi.python.org/pypi/yafowil.widget.tiptap
|
|
7
|
+
:alt: Number of PyPI downloads
|
|
8
|
+
|
|
9
|
+
.. image:: https://github.com/conestack/yafowil.widget.tiptap/actions/workflows/test_py.yaml/badge.svg
|
|
10
|
+
:target: https://github.com/conestack/yafowil.widget.tiptap/actions/workflows/test_py.yaml
|
|
11
|
+
:alt: Test yafowil.widget.tiptap Python
|
|
12
|
+
|
|
13
|
+
.. image:: https://github.com/conestack/yafowil.widget.tiptap/actions/workflows/test_js.yaml/badge.svg
|
|
14
|
+
:target: https://github.com/conestack/yafowil.widget.tiptap/actions/workflows/test_js.yaml
|
|
15
|
+
:alt: Test yafowil.widget.tiptap JS
|
|
16
|
+
|
|
17
|
+
This is a **tiptap editor widget** for `YAFOWIL
|
|
18
|
+
<http://pypi.python.org/pypi/yafowil>`_
|
|
19
|
+
|
|
20
|
+
- `Tiptap Editor <https://github.com/ueberdosis/tiptap>`_
|
|
21
|
+
- `DEMO - see it Live <http://demo.yafowil.info/++widget++yafowil.widget.tiptap/index.html>`_
|
|
22
|
+
|
|
23
|
+
Currently included version of tiptap editor is 2.0.0-beta.166.
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
Source Code
|
|
27
|
+
===========
|
|
28
|
+
|
|
29
|
+
The sources are in a GIT DVCS with its main branches at
|
|
30
|
+
`github <http://github.com/conestack/yafowil.widget.tiptap>`_.
|
|
31
|
+
|
|
32
|
+
We'd be happy to see many forks and pull-requests to make YAFOWIL even better.
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
Contributors
|
|
36
|
+
============
|
|
37
|
+
|
|
38
|
+
- Robert Niederreiter
|
|
39
|
+
|
|
40
|
+
- Lena Daxenbichler
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling", "hatch-fancy-pypi-readme"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "yafowil.widget.tiptap"
|
|
7
|
+
version = "2.0.0"
|
|
8
|
+
description = "Tiptap Editor Widget for YAFOWIL"
|
|
9
|
+
readme = "README.rst"
|
|
10
|
+
license = {text = "Simplified BSD"}
|
|
11
|
+
authors = [{name = "Yafowil Contributors", email = "dev@conestack.org"}]
|
|
12
|
+
classifiers = [
|
|
13
|
+
"License :: OSI Approved :: BSD License",
|
|
14
|
+
"Environment :: Web Environment",
|
|
15
|
+
"Operating System :: OS Independent",
|
|
16
|
+
"Programming Language :: Python",
|
|
17
|
+
"Programming Language :: Python :: 3.10",
|
|
18
|
+
"Programming Language :: Python :: 3.11",
|
|
19
|
+
"Programming Language :: Python :: 3.12",
|
|
20
|
+
"Programming Language :: Python :: 3.13",
|
|
21
|
+
"Programming Language :: Python :: 3.14",
|
|
22
|
+
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
|
|
23
|
+
]
|
|
24
|
+
dependencies = [
|
|
25
|
+
"yafowil>3.99",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project.optional-dependencies]
|
|
29
|
+
test = [
|
|
30
|
+
"lxml",
|
|
31
|
+
"pytest",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[project.entry-points."yafowil.plugin"]
|
|
35
|
+
register = "yafowil.widget.tiptap:register"
|
|
36
|
+
example = "yafowil.widget.tiptap.example:get_example"
|
|
37
|
+
|
|
38
|
+
[tool.hatch.metadata.hooks.fancy-pypi-readme]
|
|
39
|
+
content-type = "text/x-rst"
|
|
40
|
+
fragments = [
|
|
41
|
+
{path = "README.rst"},
|
|
42
|
+
{text = "\n\n"},
|
|
43
|
+
{path = "CHANGES.rst"},
|
|
44
|
+
{text = "\n\n"},
|
|
45
|
+
{path = "LICENSE.rst"},
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
[tool.hatch.build.targets.sdist]
|
|
49
|
+
exclude = [
|
|
50
|
+
"/.github/",
|
|
51
|
+
"/js/",
|
|
52
|
+
"/Makefile",
|
|
53
|
+
"/mx.ini",
|
|
54
|
+
"/mxmake.yaml",
|
|
55
|
+
"/package.json",
|
|
56
|
+
"/pnpm-lock.yaml",
|
|
57
|
+
"/scss",
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
[tool.hatch.build.targets.wheel]
|
|
61
|
+
packages = ["src/yafowil"]
|
|
62
|
+
|
|
63
|
+
[tool.pytest.ini_options]
|
|
64
|
+
consider_namespace_packages = true
|
|
65
|
+
addopts = ["--import-mode=importlib"]
|
|
66
|
+
pythonpath = "src"
|
|
67
|
+
|
|
68
|
+
[tool.zest-releaser]
|
|
69
|
+
create-wheel = true
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
from yafowil.base import factory
|
|
2
|
+
from yafowil.utils import entry_point
|
|
3
|
+
import os
|
|
4
|
+
import webresource as wr
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
resources_dir = os.path.join(os.path.dirname(__file__), 'resources')
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
##############################################################################
|
|
11
|
+
# Tiptap
|
|
12
|
+
##############################################################################
|
|
13
|
+
|
|
14
|
+
# webresource ################################################################
|
|
15
|
+
|
|
16
|
+
tiptap_js = wr.ScriptResource(
|
|
17
|
+
name='tiptap-js',
|
|
18
|
+
directory=os.path.join(resources_dir, 'tiptap'),
|
|
19
|
+
path='yafowil-tiptap/tiptap',
|
|
20
|
+
resource='tiptap.js',
|
|
21
|
+
compressed='tiptap.min.js'
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
##############################################################################
|
|
25
|
+
# Default
|
|
26
|
+
##############################################################################
|
|
27
|
+
|
|
28
|
+
# webresource ################################################################
|
|
29
|
+
|
|
30
|
+
resources = wr.ResourceGroup(
|
|
31
|
+
name='yafowil.widget.tiptap',
|
|
32
|
+
directory=resources_dir,
|
|
33
|
+
path='yafowil-tiptap'
|
|
34
|
+
)
|
|
35
|
+
resources.add(tiptap_js)
|
|
36
|
+
resources.add(wr.ScriptResource(
|
|
37
|
+
name='yafowil-tiptap-js',
|
|
38
|
+
directory=os.path.join(resources_dir, 'default'),
|
|
39
|
+
path='yafowil-tiptap/default',
|
|
40
|
+
depends=['jquery-js', 'tiptap-js'],
|
|
41
|
+
resource='widget.js',
|
|
42
|
+
compressed='widget.min.js'
|
|
43
|
+
))
|
|
44
|
+
resources.add(wr.StyleResource(
|
|
45
|
+
name='yafowil-tiptap-css',
|
|
46
|
+
directory=os.path.join(resources_dir, 'default'),
|
|
47
|
+
path='yafowil-tiptap/default',
|
|
48
|
+
resource='widget.min.css'
|
|
49
|
+
))
|
|
50
|
+
|
|
51
|
+
# B/C resources ##############################################################
|
|
52
|
+
|
|
53
|
+
js = [{
|
|
54
|
+
'group': 'yafowil.widget.tiptap.dependencies',
|
|
55
|
+
'resource': 'tiptap/tiptap.js',
|
|
56
|
+
'order': 21,
|
|
57
|
+
}, {
|
|
58
|
+
'group': 'yafowil.widget.tiptap.common',
|
|
59
|
+
'resource': 'default/widget.js',
|
|
60
|
+
'order': 21,
|
|
61
|
+
}]
|
|
62
|
+
css = [{
|
|
63
|
+
'group': 'yafowil.widget.tiptap.common',
|
|
64
|
+
'resource': 'default/widget.min.css',
|
|
65
|
+
'order': 21,
|
|
66
|
+
}]
|
|
67
|
+
|
|
68
|
+
##############################################################################
|
|
69
|
+
# Bootstrap 5
|
|
70
|
+
##############################################################################
|
|
71
|
+
|
|
72
|
+
# webresource ################################################################
|
|
73
|
+
|
|
74
|
+
bootstrap5_resources = wr.ResourceGroup(
|
|
75
|
+
name='yafowil.widget.tiptap',
|
|
76
|
+
directory=resources_dir,
|
|
77
|
+
path='yafowil-tiptap'
|
|
78
|
+
)
|
|
79
|
+
bootstrap5_resources.add(tiptap_js)
|
|
80
|
+
bootstrap5_resources.add(wr.ScriptResource(
|
|
81
|
+
name='yafowil-tiptap-js',
|
|
82
|
+
directory=os.path.join(resources_dir, 'bootstrap5'),
|
|
83
|
+
path='yafowil-tiptap/bootstrap5',
|
|
84
|
+
depends=['jquery-js', 'tiptap-js'],
|
|
85
|
+
resource='widget.js',
|
|
86
|
+
compressed='widget.min.js'
|
|
87
|
+
))
|
|
88
|
+
bootstrap5_resources.add(wr.StyleResource(
|
|
89
|
+
name='yafowil-tiptap-css',
|
|
90
|
+
directory=os.path.join(resources_dir, 'bootstrap5'),
|
|
91
|
+
path='yafowil-tiptap/bootstrap5',
|
|
92
|
+
resource='widget.min.css'
|
|
93
|
+
))
|
|
94
|
+
# B/C resources ##############################################################
|
|
95
|
+
|
|
96
|
+
bootstrap5_js = [{
|
|
97
|
+
'group': 'yafowil.widget.tiptap.dependencies',
|
|
98
|
+
'resource': 'tiptap/tiptap.js',
|
|
99
|
+
'order': 20,
|
|
100
|
+
}, {
|
|
101
|
+
'group': 'yafowil.widget.tiptap.common',
|
|
102
|
+
'resource': 'bootstrap5/widget.js',
|
|
103
|
+
'order': 21,
|
|
104
|
+
}]
|
|
105
|
+
bootstrap5_css = [{
|
|
106
|
+
'group': 'yafowil.widget.tiptap.common',
|
|
107
|
+
'resource': 'bootstrap5/widget.min.css',
|
|
108
|
+
'order': 21,
|
|
109
|
+
}]
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
##############################################################################
|
|
113
|
+
# Registration
|
|
114
|
+
##############################################################################
|
|
115
|
+
|
|
116
|
+
@entry_point(order=10)
|
|
117
|
+
def register():
|
|
118
|
+
from yafowil.widget.tiptap import widget # noqa
|
|
119
|
+
|
|
120
|
+
widget_name = 'yafowil.widget.tiptap'
|
|
121
|
+
|
|
122
|
+
# Default
|
|
123
|
+
factory.register_theme(
|
|
124
|
+
'default',
|
|
125
|
+
widget_name,
|
|
126
|
+
resources_dir,
|
|
127
|
+
js=js,
|
|
128
|
+
css=css
|
|
129
|
+
)
|
|
130
|
+
factory.register_resources('default', widget_name, resources)
|
|
131
|
+
|
|
132
|
+
# Bootstrap 5
|
|
133
|
+
factory.register_theme(
|
|
134
|
+
['bootstrap5'],
|
|
135
|
+
widget_name,
|
|
136
|
+
resources_dir,
|
|
137
|
+
js=bootstrap5_js,
|
|
138
|
+
css=bootstrap5_css
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
factory.register_resources(
|
|
142
|
+
['bootstrap5'],
|
|
143
|
+
widget_name,
|
|
144
|
+
bootstrap5_resources
|
|
145
|
+
)
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
from yafowil.base import factory
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
DOC_DEFAULT_TIPTAP = """
|
|
6
|
+
Default Tiptap widget
|
|
7
|
+
---------------------
|
|
8
|
+
|
|
9
|
+
.. code-block:: python
|
|
10
|
+
|
|
11
|
+
tiptap = factory('tiptap', value="<p>Hello World!</p>", props={
|
|
12
|
+
'label': 'Default Widget'
|
|
13
|
+
})
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def default_example():
|
|
18
|
+
part = factory(u'fieldset', name='yafowil.widget.tiptap')
|
|
19
|
+
part['tiptap'] = factory(
|
|
20
|
+
'#field:tiptap',
|
|
21
|
+
value='<p>Hello World!</p>',
|
|
22
|
+
props={
|
|
23
|
+
'label': 'Default Widget'
|
|
24
|
+
})
|
|
25
|
+
return {
|
|
26
|
+
'widget': part,
|
|
27
|
+
'doc': DOC_DEFAULT_TIPTAP,
|
|
28
|
+
'title': 'Tiptap'
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
DOC_ACTIONS_TIPTAP = """
|
|
33
|
+
Tiptap widget actions
|
|
34
|
+
---------------------
|
|
35
|
+
|
|
36
|
+
Actions of the tiptap widget can be customized. Action buttons can be grouped
|
|
37
|
+
together by putting them in a list.
|
|
38
|
+
|
|
39
|
+
.. code-block:: python
|
|
40
|
+
|
|
41
|
+
tiptap = factory(
|
|
42
|
+
'tiptap',
|
|
43
|
+
value='<p>This widget has customized actions.</p>',
|
|
44
|
+
props={
|
|
45
|
+
'label': 'Tiptap Widget with customized actions',
|
|
46
|
+
'actions': [
|
|
47
|
+
['heading', 'color'],
|
|
48
|
+
['bold', 'italic', 'underline'],
|
|
49
|
+
['bulletList', 'orderedList', 'indent', 'outdent'],
|
|
50
|
+
['html'],
|
|
51
|
+
['image', 'link'],
|
|
52
|
+
['code', 'codeBlock']
|
|
53
|
+
]
|
|
54
|
+
})
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def actions_example():
|
|
59
|
+
part = factory(u'fieldset', name='yafowil.widget.tiptap')
|
|
60
|
+
part['tiptap'] = factory(
|
|
61
|
+
'#field:tiptap',
|
|
62
|
+
value='<p>This widget has customized actions.</p>',
|
|
63
|
+
props={
|
|
64
|
+
'label': 'Tiptap Widget with customized actions',
|
|
65
|
+
'actions': [
|
|
66
|
+
['heading', 'color'],
|
|
67
|
+
['bold', 'italic', 'underline'],
|
|
68
|
+
['bulletList', 'orderedList', 'indent', 'outdent'],
|
|
69
|
+
['html'],
|
|
70
|
+
['image', 'link'],
|
|
71
|
+
['code', 'codeBlock']
|
|
72
|
+
]
|
|
73
|
+
})
|
|
74
|
+
return {
|
|
75
|
+
'widget': part,
|
|
76
|
+
'doc': DOC_ACTIONS_TIPTAP,
|
|
77
|
+
'title': 'Tiptap Widget with customized actions',
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
DOC_COLORS_TIPTAP = """
|
|
83
|
+
Tiptap Widget colors
|
|
84
|
+
--------------------
|
|
85
|
+
|
|
86
|
+
To customize the color selection of the ``colors`` action, pass a list
|
|
87
|
+
of colors to widget properties.
|
|
88
|
+
|
|
89
|
+
Colors can only be supplied as rgb() values.
|
|
90
|
+
|
|
91
|
+
.. code-block:: python
|
|
92
|
+
|
|
93
|
+
tiptap = factory(
|
|
94
|
+
'tiptap',
|
|
95
|
+
value=(
|
|
96
|
+
'<p>'
|
|
97
|
+
'<span style="color: rgb(66,209,245)">This widget</span> has '
|
|
98
|
+
'<span style="color: rgb(161,66,245)">custom colors</span>.'
|
|
99
|
+
'</p>'
|
|
100
|
+
),
|
|
101
|
+
props={
|
|
102
|
+
'label': 'Tiptap Widget with custom colors',
|
|
103
|
+
'actions': ['color'],
|
|
104
|
+
'colors': [
|
|
105
|
+
{'name': 'Purple', 'color': 'rgb(161,66,245)'},
|
|
106
|
+
{'name': 'Blue', 'color': 'rgb(66,111,245)'},
|
|
107
|
+
{'name': 'Turqoise', 'color': 'rgb(66,209,245)'},
|
|
108
|
+
{'name': 'Green', 'color': 'rgb(105,245,66)'},
|
|
109
|
+
{'name': 'Yellow', 'color': 'rgb(245,236,66)'},
|
|
110
|
+
{'name': 'Orange', 'color': 'rgb(245,167,66'},
|
|
111
|
+
{'name': 'Red', 'color': 'rgb(245,66,66)'}
|
|
112
|
+
]
|
|
113
|
+
})
|
|
114
|
+
"""
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def colors_example():
|
|
118
|
+
part = factory(u'fieldset', name='yafowil.widget.tiptap')
|
|
119
|
+
part['tiptap'] = factory(
|
|
120
|
+
'tiptap',
|
|
121
|
+
value=(
|
|
122
|
+
'<p>'
|
|
123
|
+
'<span style="color: rgb(66,209,245)">This widget</span> has '
|
|
124
|
+
'<span style="color: rgb(161,66,245)">custom colors</span>.'
|
|
125
|
+
'</p>'
|
|
126
|
+
),
|
|
127
|
+
props={
|
|
128
|
+
'label': 'Tiptap Widget with custom colors',
|
|
129
|
+
'actions': ['color'],
|
|
130
|
+
'colors': [
|
|
131
|
+
{'name': 'Purple', 'color': 'rgb(161,66,245)'},
|
|
132
|
+
{'name': 'Blue', 'color': 'rgb(66,111,245)'},
|
|
133
|
+
{'name': 'Turqoise', 'color': 'rgb(66,209,245)'},
|
|
134
|
+
{'name': 'Green', 'color': 'rgb(105,245,66)'},
|
|
135
|
+
{'name': 'Yellow', 'color': 'rgb(245,236,66)'},
|
|
136
|
+
{'name': 'Orange', 'color': 'rgb(245,167,66'},
|
|
137
|
+
{'name': 'Red', 'color': 'rgb(245,66,66)'}
|
|
138
|
+
]
|
|
139
|
+
})
|
|
140
|
+
return {
|
|
141
|
+
'widget': part,
|
|
142
|
+
'doc': DOC_COLORS_TIPTAP,
|
|
143
|
+
'title': 'Tiptap Widget with custom colors',
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
DOC_DISPLAY_TIPTAP = """
|
|
148
|
+
Display Mode
|
|
149
|
+
------------
|
|
150
|
+
|
|
151
|
+
In Display Mode, the widget is not editable and Actions will not be rendered.
|
|
152
|
+
The ``display_class`` widget property can be used to style the div containing the
|
|
153
|
+
widget value.
|
|
154
|
+
|
|
155
|
+
.. code-block:: python
|
|
156
|
+
|
|
157
|
+
tiptap = factory(
|
|
158
|
+
'tiptap',
|
|
159
|
+
value=(
|
|
160
|
+
'<p>'
|
|
161
|
+
'This widget is in '
|
|
162
|
+
'<strong style="color: rgb(66,209,245)">display mode</strong>, '
|
|
163
|
+
'but it will still show <strong>custom formatting</strong>.'
|
|
164
|
+
'<br />'
|
|
165
|
+
'Its border was adding with the <strong>display_class</strong> property.'
|
|
166
|
+
'</p>'
|
|
167
|
+
),
|
|
168
|
+
props={
|
|
169
|
+
'label': 'Tiptap Widget in display mode',
|
|
170
|
+
'actions': ['color'],
|
|
171
|
+
'colors': [
|
|
172
|
+
{'name': 'Purple', 'color': 'rgb(161,66,245)'},
|
|
173
|
+
{'name': 'Blue', 'color': 'rgb(66,111,245)'},
|
|
174
|
+
{'name': 'Turqoise', 'color': 'rgb(66,209,245)'},
|
|
175
|
+
{'name': 'Green', 'color': 'rgb(105,245,66)'},
|
|
176
|
+
{'name': 'Yellow', 'color': 'rgb(245,236,66)'},
|
|
177
|
+
{'name': 'Orange', 'color': 'rgb(245,167,66'},
|
|
178
|
+
{'name': 'Red', 'color': 'rgb(245,66,66)'}
|
|
179
|
+
],
|
|
180
|
+
'display_class': 'form-control border-2 border-info'
|
|
181
|
+
},
|
|
182
|
+
mode='display')
|
|
183
|
+
"""
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
def display_example():
|
|
187
|
+
part = factory(u'fieldset', name='yafowil.widget.tiptap')
|
|
188
|
+
part['tiptap'] = factory(
|
|
189
|
+
'tiptap',
|
|
190
|
+
value=(
|
|
191
|
+
'<p>'
|
|
192
|
+
'This widget is in '
|
|
193
|
+
'<strong style="color: rgb(66,209,245)">display mode</strong>, '
|
|
194
|
+
'but it will still show <strong>custom formatting</strong>.'
|
|
195
|
+
'<br />'
|
|
196
|
+
'Its border was adding with the <strong>display_class</strong> property.'
|
|
197
|
+
'</p>'
|
|
198
|
+
),
|
|
199
|
+
props={
|
|
200
|
+
'label': 'Tiptap Widget in display mode',
|
|
201
|
+
'actions': ['color'],
|
|
202
|
+
'colors': [
|
|
203
|
+
{'name': 'Purple', 'color': 'rgb(161,66,245)'},
|
|
204
|
+
{'name': 'Blue', 'color': 'rgb(66,111,245)'},
|
|
205
|
+
{'name': 'Turqoise', 'color': 'rgb(66,209,245)'},
|
|
206
|
+
{'name': 'Green', 'color': 'rgb(105,245,66)'},
|
|
207
|
+
{'name': 'Yellow', 'color': 'rgb(245,236,66)'},
|
|
208
|
+
{'name': 'Orange', 'color': 'rgb(245,167,66'},
|
|
209
|
+
{'name': 'Red', 'color': 'rgb(245,66,66)'}
|
|
210
|
+
],
|
|
211
|
+
'display_class': 'form-control border-2 border-info'
|
|
212
|
+
}, mode='display')
|
|
213
|
+
return {
|
|
214
|
+
'widget': part,
|
|
215
|
+
'doc': DOC_DISPLAY_TIPTAP,
|
|
216
|
+
'title': 'Tiptap Widget in display mode',
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
def get_example():
|
|
221
|
+
return [
|
|
222
|
+
default_example(),
|
|
223
|
+
actions_example(),
|
|
224
|
+
colors_example(),
|
|
225
|
+
display_example()
|
|
226
|
+
]
|