Edit article, select CMS Content dropdown, select read more.
read more added to WYSIWYG
JS Error
Uncaught TypeError: (intermediate value)(intermediate value)(intermediate value).match is not a function
79fd949
Google chrome
Labels |
Added:
?
|
Title |
|
Status | New | ⇒ | Discussion |
Category | ⇒ | com_content JavaScript |
I CAN replicate on Firefox and Safari.
Those that can't should test from last staging.
Exactly the same error pointed by @PhilETaylor
TypeError: (intermediate value).match is not a function[Learn More]
admin-article-readmore.min.js:1:161
window.insertReadmore
http://localhost:8888/newfolder/joomla40/media/com_content/js/admin-article-readmore.min.js:1:161
anonymous
http://localhost:8888/newfolder/joomla40/media/editors/tinymce/js/tinymce.min.js:3:1
setupEditor/</n.onclick
http://localhost:8888/newfolder/joomla40/media/editors/tinymce/js/tinymce.min.js:1:871
vm/r.fire
http://localhost:8888/newfolder/joomla40/media/vendor/tinymce/tinymce.min.js:1:187603
fire
http://localhost:8888/newfolder/joomla40/media/vendor/tinymce/themes/modern/theme.min.js:1:30800
a
http://localhost:8888/newfolder/joomla40/media/vendor/tinymce/themes/modern/theme.min.js:1:35026
u
http://localhost:8888/newfolder/joomla40/media/vendor/tinymce/tinymce.min.js:1:11719
C
http://localhost:8888/newfolder/joomla40/media/vendor/tinymce/tinymce.min.js:1:11870
l
http://localhost:8888/newfolder/joomla40/media/vendor/webcomponentsjs/js/webcomponents-hi-sd-ce.min.js:1:25807
Status | Discussion | ⇒ | Confirmed |
Setting to confirmed
Here is the code for admin-article-readmore.es6.js:
(() => {
'use strict';
const options = window.Joomla.getOptions('xtd-readmore');
window.insertReadmore = (editor) => {
if (!options) {
// Something went wrong!
throw new Error(`XTD Button 'read more' not properly initialized`)
}
const content = window.Joomla.editors.instances[editor].getValue();
if (content && !content.match(/<hr\s+id=("|')system-readmore("|')\s*\/*>/i)) {
Joomla.editors.instances[editor].replaceSelection('<hr id="system-readmore">');
} else {
// TODO replace with joomla-alert
alert(options.exists);
return false;
}
return true;
};
})();
If someone can make a pr I would really appreciate it
Thank @infograf768, now yes. I can replicate it. I thought I had the last staging.
@dgrammatiko
Looks like we have to modify
content.match
to editor.match
Files concerned
/media/com_content/js/admin-article-readmore.es6.js
/media/com_content/js/admin-article-readmore.js
And then correct the minified files.
If I do that, no more errors.
Want me to do the PR?
NOTE: What we have in core is different from what you pasted above
Looks like we have to modify content.match to editor.match
Nope, I've already provided the code (it's also tested)
@dgrammatiko
I just wanted to help. The issue is NOT here in the e6 but in the admin-article-readmore.js and minified
Please do as you wish.
the admin-article-readmore.js is generated from the es6 file, that's the source
OK, then do it as I don't know how to.
BTW, with your proposal I guess you don't have an error but also you can insert as many read more (hr
) as you like
Labels |
Added:
J4 Issue
|
@dgrammatiko
Looks like nobody made a PR with your code,
that works alright BTW.
I can do it but I need some details:
if I understand properly, the modified code should be applied to:
admin-article-readmore.es6.js
??
what I don't get is how to minify it. Can I use a minifying tool online ?
Or else ?
I postponed until now my digging into npm. Guess this is the opportunity.
Tks for your tuto.
Thank your for stepping up to help.
Status | Confirmed | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-07-21 12:48:32 |
Closed_By | ⇒ | brianteeman |
Could not replicate