You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The project includes a separate SCSS file for styling the djangoCMS Text Editor (TipTap) in the admin interface. This ensures that colors and styles in the editor match your theme settings.
91
+
92
+
What It Does
93
+
------------
94
+
95
+
The ``tiptap_admin.scss`` file:
96
+
97
+
- Imports your theme variables (colors, fonts, etc.)
98
+
- Defines CSS classes for text and background colors used in the editor
99
+
- Compiles to ``backend/static/djangocms_text/css/tiptap.admin.css``
100
+
- Uses the same color values as your frontend theme
101
+
- Scopes all styles under ``.cms-admin`` to avoid conflicts
102
+
103
+
How It Works
104
+
------------
105
+
106
+
When you run ``npm run dev`` or ``npm run build``, two CSS files are compiled **in parallel**:
107
+
108
+
1. **main.css** - Your frontend styles
109
+
2. **tiptap.admin.css** - Admin editor styles
110
+
111
+
The build process automatically:
112
+
113
+
- Reads your theme colors from ``_variables.scss``
114
+
- Generates matching CSS for the editor
115
+
- Outputs to ``backend/static/djangocms_text/css/tiptap.admin.css``
116
+
117
+
Customizing Editor Colors
118
+
--------------------------
119
+
120
+
To add or modify colors in the editor:
121
+
122
+
1. **Update the SCSS file:**
123
+
124
+
Edit ``backend/static/scss/tiptap_admin.scss`` and add your color class:
125
+
126
+
.. code-block:: scss
127
+
128
+
.cms-admin {
129
+
.text-custom {
130
+
color: $your-custom-color !important;
131
+
}
132
+
}
133
+
134
+
2. **Register in Django settings:**
135
+
136
+
Add the color to ``TEXT_EDITOR_SETTINGS`` in ``backend/settings.py``:
137
+
138
+
.. code-block:: python
139
+
140
+
TEXT_EDITOR_SETTINGS= {
141
+
"textColors": {
142
+
"text-custom": {"name": "Custom Color"},
143
+
# ... other colors
144
+
},
145
+
}
146
+
147
+
3. **Rebuild CSS:**
148
+
149
+
The watcher will automatically rebuild, or run manually:
150
+
151
+
.. code-block:: bash
152
+
153
+
npx gulp styles
154
+
155
+
Why No Source Maps?
156
+
--------------------
157
+
158
+
The ``tiptap.admin.css`` file is intentionally compiled **without source maps** to keep the admin interface clean. The file is simple enough for debugging without source maps, and it reduces clutter in the admin CSS directory.
159
+
160
+
If you need source maps for debugging, you can modify ``gulpfile.js`` line 40-52 to add ``sourcemaps.init()`` and ``sourcemaps.write(".")``.
83
161
84
162
Local Development Workflow
85
163
===========================
@@ -173,6 +251,27 @@ Docker vs Local
173
251
- **Local development**: You need to run ``npm install`` and ``npm run dev`` on your host machine
174
252
- ``node_modules/`` is in ``.gitignore`` (correct) - each environment needs its own installation
175
253
254
+
TipTap Admin CSS not updating
255
+
------------------------------
256
+
257
+
If changes to ``tiptap_admin.scss`` aren't reflected in the admin:
258
+
259
+
1. Verify the file is being compiled:
260
+
261
+
.. code-block:: bash
262
+
263
+
ls -la backend/static/djangocms_text/css/tiptap.admin.css
264
+
265
+
2. Check that the file is not in ``.gitignore`` (it should be)
266
+
3. Rebuild manually:
267
+
268
+
.. code-block:: bash
269
+
270
+
npx gulp styles
271
+
272
+
4. Restart Django (``python manage.py runserver`` or ``docker compose restart``)
0 commit comments