小编Zep*_*hyr的帖子

QuillJS:无法注册自定义类属性

我的项目正在使用 QuillJS。我正在尝试添加自定义类属性。我希望我的链接能够没有类名,或者类名“自定义链接”。阅读此处的文档https://github.com/quilljs/parchment#class-attributor我编写了以下代码:

const Parchment = Quill.import('parchment');
const CustomLinkClass = new Parchment.Attributor.Class('custom-link', 'custom-link', {
  scope: Parchment.Scope.INLINE
});
Quill.register(CustomLinkClass, true);
Run Code Online (Sandbox Code Playgroud)

但是,当我插入<a class="custom-link" href="https://google.com">Hello</a>编辑器时,类名被删除。有人可以帮忙吗?

这里有一个 Quill Playground 示例:https ://codepen.io/anon/pen/qoPVxO

javascript quill

5
推荐指数
1
解决办法
1603
查看次数

使用flexbox将子div拆分为列

我正在尝试实现下图所示的列布局。我需要

  • 最高 3列
  • 最高 一列中有11个孩子,然后第12个孩子开始新的一列
  • 每个奇数行上的背景为浅色,每个偶数行上的背景为暗色

在此处输入图片说明

如果没有足够的孩子组成一个新列,其他列应填满水平空间,就像这样:

在此处输入图片说明

https://jsfiddle.net/qLx7sun1/

.parent {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  /*flex-direction: column;
  height: calc(20px * 11);*/
}
.parent div {
  flex: 1 0 31%;
  max-width: 31%;
  background: grey;
  height: 20px;
  margin-bottom: 1rem;
}
Run Code Online (Sandbox Code Playgroud)

这是我到目前为止所拥有的;但是,子级将父级填充为行而不是列。如果我取消注释,flex-direction: column;那看起来真的很奇怪。我也没有设法获得交替行的背景。

我可以通过CSS / flexbox实现此功能还是必须使用Javascript?

html javascript css flexbox

4
推荐指数
1
解决办法
3316
查看次数

标签 统计

javascript ×2

css ×1

flexbox ×1

html ×1

quill ×1