Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Change the way we render the react components

Roland Geider8130fd1593e7
diff --git a/wger/core/static/css/react-simple-wysiwyg.css b/wger/core/static/css/react-simple-wysiwyg.css
deleted file mode 100644
index 5579898ed..000000000
--- a/wger/core/static/css/react-simple-wysiwyg.css
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- This file is part of Workout Manager
-
- Workout Manager is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- Workout Manager 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 Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with Workout Manager. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/*
- * Hack: this is the copied CSS from https://github.com/megahertz/react-simple-wysiwyg
- * so that the styles are loaded when loading this in a shadow dom in the django
- * application.
- */
-.rsw-editor {
- border: 1px solid #ddd;
- border-radius: 0.375rem;
- display: flex;
- flex-direction: column;
- min-height: 100px;
- overflow: hidden;
-}
-
-.rsw-ce {
- flex: 1 0 auto;
- padding: 0.5rem;
-}
-
-.rsw-ce:focus {
- outline: 1px solid #668;
-}
-
-.rsw-ce[contentEditable='true']:empty:not(:focus):before {
- content: attr(placeholder);
- color: grey;
-}
-
-.rsw-html {
- background: transparent;
- border: none;
- font-family: monospace, 'Courier New';
-}
-
-.rsw-separator {
- align-self: stretch;
- border-right: 1px solid #ddd;
- display: flex;
- margin: 0 3px;
-}
-
-.rsw-dd {
- box-sizing: border-box;
- outline: none;
-}
-
-.rsw-btn {
- background: transparent;
- border: 0;
- cursor: pointer;
- color: #222;
- font-size: 1em;
- height: 2em;
- outline: none;
- padding: 0;
- width: 2em;
-}
-
-.rsw-btn:hover {
- background: #eaeaea;
-}
-
-.rsw-btn[data-active='true'] {
- background: #e0e0e0;
-}
-
-.rsw-toolbar {
- align-items: center;
- background-color: #f5f5f5;
- border-bottom: 1px solid #ddd;
- display: flex;
-}
diff --git a/wger/core/templates/template.html b/wger/core/templates/template.html
index 15cd0190d..f4dbcd707 100644
--- a/wger/core/templates/template.html
+++ b/wger/core/templates/template.html
@@ -53,14 +53,6 @@
<link rel="stylesheet" type="text/css" href="{% static 'node/@wger-project/react-components/build/assets/index.css' %}" id="react-css">
{% endcompress %}
- {# this needs to be outside of the compress block! #}
- <link
- rel="stylesheet"
- type="text/css"
- href="{% static 'css/react-simple-wysiwyg.css' %}"
- id="react-css"
- >
-
<link rel="stylesheet" href="{% static 'css/language-menu.css' %}">
<link rel="icon" href="{% static 'images/favicon.png' %}" type="image/png">
diff --git a/wger/core/views/react.py b/wger/core/views/react.py
index 91d1e452e..e632e0d45 100644
--- a/wger/core/views/react.py
+++ b/wger/core/views/react.py
@@ -25,7 +25,13 @@ class ReactView(TemplateView):
"""
template_name = 'react/react-page.html'
- div_id = 'react-page'
+ div_id = 'react-page-no-shadow-dom'
+ """
+ Default div ID where the React app is mounted
+
+ If you want to render the component in a shadow dom, use 'react-page' instead.
+ """
+
login_required = False
def get_context_data(self, **kwargs):
diff --git a/wger/manager/urls.py b/wger/manager/urls.py
index fa793fb79..111ff5d3a 100644
--- a/wger/manager/urls.py
+++ b/wger/manager/urls.py
@@ -68,11 +68,9 @@ patterns_routine = [
ReactView.as_view(login_required=True),
name='add',
),
- # Note that this needs to be the no-shadow-dom variant till this issue is fixed:
- # https://github.com/hello-pangea/dnd/issues/425
path(
'<int:pk>/edit',
- ReactView.as_view(login_required=True, div_id='react-page-no-shadow-dom'),
+ ReactView.as_view(login_required=True),
name='edit',
),
path(