kirby-link-field icon indicating copy to clipboard operation
kirby-link-field copied to clipboard

[k4] Plugin breaks link picker in Writer / Text fields

Open skraby opened this issue 1 year ago • 11 comments

In Kirby v4, there is new dialogue for picking pages/files from within writer or text fields by clicking the link icon. This plugin brakes this functionality, the picker doesn't show up at all.

image

Temporary fix is to register this link field under different name (don't extend Kirby's link field).

skraby avatar Feb 05 '24 09:02 skraby

@skraby what do you mean by "register this link field under different name"? Different name in the blueprint, or?

hdodov avatar Feb 05 '24 16:02 hdodov

@hdodov Sorry for the confusion. You register your plugin as link, effectively overriding Kirby's native link field. If you register it under different name, e.g. 'customLink', it works alongside Kirby's native link field. You need then change all occurrences of type: link to type: customLink in your blueprints of course.

skraby avatar Feb 05 '24 17:02 skraby

@hdodov @skraby that's why we currenlty use a modified version of the this plugin in our k4 projects with the name of linklegacy 😜

owzim avatar Feb 08 '24 11:02 owzim

@owzim can you please specify where you changed the name? only in the index.php?

squareclouds avatar May 10 '24 10:05 squareclouds

Many thanks for updating the plugin for k4. A fix for that namespace conflict would be fantastic.

foxacid avatar Jun 25 '24 07:06 foxacid

@owzim can you please specify where you changed the name? only in the index.php?

Line 6 of app/index.js and line 41 of index.php.

foxacid avatar Jun 25 '24 08:06 foxacid

@foxacid I'm really busy lately. If you're able to send a pull request, I'd be happy to merge it!

hdodov avatar Jun 26 '24 07:06 hdodov

@hdodov great, thanks. Pull request is out. Unfortunately the solution is a breaking change. However, it should only affect the field type name in blueprints. Similar to the suggestions above all occurences of type: link must be changed to type: legacyLink.

foxacid avatar Jun 26 '24 10:06 foxacid

@foxacid cool that you did the pull request! one suggestion though, legacylink might not be the best wording. it kinda communicates that there is a new version somehow, and technically this plugin is rather an alternative to the official link field. maybe something like "linkfield" would be more transparent. for us, since we have using it before, legacy is understandable, but for people using it for the first time sounds strange. what do you think?

squareclouds avatar Jun 26 '24 11:06 squareclouds

@squareclouds I see what you mean. On the other hand I think that the current version of kirby-link-field really exists to provide legacy support for older projects. While there are functional differences between the two fields, for new projects I would definitely recommend to use the native K4 link field (e.g. as part of an object field). I think the plugin developer recommends the same and I'll leave the name choice to the original author.

foxacid avatar Jun 26 '24 11:06 foxacid

Yep, I definitely think users of the plugin should move to the native link field in Kirby. It's supported by the core team and will continue to do so during version updates. This really is a field of older projects where such a field didn't exist.

I've published version 6.0.1 of the plugin with the fix. Let me know if it works. I didn't have time to test.

hdodov avatar Jul 16 '24 05:07 hdodov

The update is missing in the root index.js It is still named "link" there e.g. components: { "k-link-field-preview": L },

MathiasGmeiner avatar Jul 29 '24 12:07 MathiasGmeiner

@MathiasGmeiner yep, you're right. It was missing from the compiled JS. I've published version 6.0.2 which should fix this. Could you test it out?

hdodov avatar Aug 04 '24 08:08 hdodov

Sorry I forgot to check in the compiled code. I just tested 6.0.2 and it works fine.

foxacid avatar Aug 04 '24 16:08 foxacid

@hdodov it works great now, thank you!

MathiasGmeiner avatar Aug 05 '24 18:08 MathiasGmeiner