Open medienbaecker opened 8 months ago
FYI: because this issue is quite the big deal in a current project I've fixed it like this for now:
src/components/Buttons/Link.js
submit: (values) => {
this.input.$panel.dialog.close();
delete values.title;
values.text = values.text || contents || null;
+ values.href = values.href.replace('/@/page/', 'page://');
this.insertLink(values);
}
Of course a better solution would be to reuse the textarea dialog but I generally have no idea what I'm doing.
After some time studying Kirby's code I think I know now why/how textarea and writer insert different links:
file://
with /@/file/
and page://
with /@/page/
. The writer uses this component without touching the submit method..replace
.$panel.dialog.open()
method to open the dialog as it is. Extending the link dialog like the textarea does is not that easy, though. There seems to be a way to configure kirbyup to allow importing components from the Kirby code but for this to work I think we have to update kirbyup first and that didn't work out for me.Maybe this helps someone in understanding the problem at hand. Or future-me at least.
The markdown field inserts permalinks in a different structure compared to the textarea field:
This is a problem in the frontend, where page links are not correct:
It also does not help to run permalinksToUrls() on the field.