如何将一个模型属性转换为ckeditor5中的另一个模型属性?

发布于 2025-01-26 06:03:16 字数 307 浏览 3 评论 0原文

我正在设置提及插件,并希望它的行为能力,以便插入(从下拉菜单中)插入带有链接的文本,即使您编辑文本,该链接仍然保留。

默认情况下,如果您编辑提及的文本,则CKEditor删除了提及/链接。

我对这样做的最佳方法的猜测是将模型中的属性转换为linkhref属性。有办法这样做吗?

我知道升起和降低转换,但是修改这些转换并不能做我想要的。看来我们确实需要修改模型。

(在中评论第61和63行[提到的> JS] [1]实际上可以防止不希望的行为,但这似乎不是解决问题的理想解决方案。)

I'm setting up the Mentions plugin and want it to behave such that inserting a Mention (from the dropdown menu) inserts text with a link, and that link remains even if you edit the text.

By default, if you edit the text of the mention, ckEditor removes the mention/link.

My guess of the best way to do this is to convert the Mention attribute in the Model to a linkHref attribute. Is there a way to do this?

I'm aware of upcast and downcast conversion, but modifying these doesn't do what I want. It seems we really need a modification of a model.

(Commenting out lines 61 and 63 in [mentionediting.js][1] can actually prevent the undesired behavior, but this doesn't seem like the ideal solution to the problem.)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文