Hashtags
This extension isn't compatible with beta 14+. Unless someone wants to adopt this extension, or give me the exact code to patch it, I think it'll have to go to the extension graveyard . From what I've read so far I assume it is due to Mithril 2.0. More specifically due to config no longer being a lifecyle hook? I don't have the skills to update it even though it's probably relatively simple. I tried making some guesses after reading some docs, but no luck.
I feel bad because I do think there are several people that use this. But, we'll have to wait for a developer to possibly, one day, create a new hashtag extension. One that is probably way better than this one.
- Edited
010101 CommentPost.prototype.config
is now CommentPost.prototype.oncreate
and CommentPost.prototype.onupdate
. There's no longer an isInitalized
parameter, instead oncreate
is called once, and onupdate
is called for subsequent redraws.
Basically
extend(CommentPost.prototype, 'config', function (out, isInitialized, vnode) {
// [the code]
});
becomes
extend(CommentPost.prototype, 'oncreate', function (out, vnode) {
// [the code]
});
extend(CommentPost.prototype, 'onupdate', function (out, vnode) {
// [the code]
});
A function can be used to not repeat the code.
Or, when isInitialized
is used:
extend(CommentPost.prototype, 'config', function (out, isInitialized, vnode) {
if (isInitialized) return;
// [the code]
});
becomes
extend(CommentPost.prototype, 'oncreate', function (out, vnode) {
// [the code]
});
EDIT: ignore my previous edit referencing super
, it only applies if you were creating your own components.
clarkwinkelmann Thank you for being willing to help! The problem is that this is one of those extensions done the wrong way where everything is in the extend.php file.
This isn't working:
<script>
flarum.core.compat.extend.extend(flarum.core.compat['components/CommentPost'].prototype, 'oncreate', function (output, context) {
if (context.customExtLastContentHtml !== context.contentHtml) {
// [the code]
context.customExtLastContentHtml = context.contentH tml;
});
</script>
Original code that did work until beta 14:
<script>
flarum.core.compat.extend.extend(flarum.core.compat['components/CommentPost'].prototype, 'config', function(output, isInitialized, context) {
if (context.customExtLastContentHtml !== context.contentHtml) {
// [the code]
context.customExtLastContentHtml = context.contentH tml;
});
</script>
010101 The arguments to oncreate are different than those to config. Replace the second argument with vnode
. Then, where you need to access the DOM element, use vnode.dom
Thanks to @clarkwinkelmann and @askvortsov this little extension will become compatible with beta 14 soon (as soon as I have a break where I can sit down at my computer).
Version 3.7 released
- Updated version constraints in composer.json
- Updated Mithril Lifecyle hook which means - now compatible with beta 14
Beta 15 ready.
- Edited
- Beta 16 ready
- Now updates both on full page refresh and after editing a post
Update with:
composer require zerosonesfun/hashtags