Skip to content

Commit

Permalink
Merge pull request #182 from goapunk/jd-2024-01-fix-config-regex-hand…
Browse files Browse the repository at this point in the history
…ling

improve handling of config values containing slashes
  • Loading branch information
hvlads authored Mar 2, 2024
2 parents 0e017a8 + a7a0742 commit 091c209
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions django_ckeditor_5/static/django_ckeditor_5/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ function createEditors() {
const config = JSON.parse(
document.getElementById(`${script_id}-span`).textContent,
(key, value) => {
if (value.toString().includes('/')) {
return new RegExp(value.replaceAll('/', ''));
var match = value.toString().match(new RegExp('^/(.*?)/([gimy]*)$'));
if (match) {
var regex = new RegExp(match[1], match[2]);
return regex;
}
return value;
}
Expand Down
1 change: 1 addition & 0 deletions example/blog/blog/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@
"reversed": True,
},
},
"link": {"defaultProtocol": "https://"},
"htmlSupport": {
"allow": [
{"name": "/.*/", "attributes": True, "classes": True, "styles": True},
Expand Down

0 comments on commit 091c209

Please sign in to comment.