使用自定义墨迹时,将删除自定义属性

时间:2017-10-27 11:29:00

标签: quill

我为链接创建了一个自定义印迹,需要手动设置@Controller public class SecurityPolicyController { @Autowired private SecurityPolicy policy; @Autowired private ApplicationContext context; @Autowired private SecurityService service; @RequestMapping(value = "/security") public ModelAndView update() { ModelAndView model = new ModelAndView(); //set data to db, it works fine aswell service.setMaxAttempts(7); //now i am trying to reload my beans ((ConfigurableApplicationContext)context).refresh(); //something reloading but i still get the same value System.out.println(policy.getMaxLoginAttempts()); model.setViewName("security"); return model; } } rel。但是,在加载具有这些属性的内容时,quill会剥离它们。我不确定为什么。

我创建了一个codepen来说明问题。

这是我的自定义污点:

target

我是否必须告诉Quill允许某些引用?

1 个答案:

答案 0 :(得分:3)

从现有HTML初始化后,Quill将尝试从中构建数据模型,这是叶片印迹的create()value()和内嵌印迹的formats()之间的对称性。鉴于如何实现create(),您需要formats()这样的内容:

  static formats(node) {
    let ret = {
      url: node.getAttribute('href'),
    };
    if (node.getAttribute('target') == '_blank') {
      ret.target = true;
    }
    if (node.getAttribute('rel') == 'nofollow') {
      ret.follow = 'nofollow';
    }
    return ret;
  }

使用此更改工作:https://codepen.io/quill/pen/xPxGgw

我建议覆盖默认链接,但不要创建另一个链接,除非出于某种原因需要两种类型。

相关问题