相关代码块:
<Slate editor={editor} value={value} onChange={value => {
setValue(value);
const { selection } = editor;
// if nothing is currently selected under the cursor
if (selection && Range.isCollapsed(selection)) {
const [start] = Range.edges(selection);
// if the two characters beforce the cursor are {{, select them and replace with a template block
const before = Editor.before(editor, start, {distance: 2})
const beforeRange = before && Editor.range(editor, before, start)
const beforeText = beforeRange && Editor.string(editor, beforeRange)
const beforeMatch = beforeText && beforeText.match(/\{\{/);
if (beforeMatch) …Run Code Online (Sandbox Code Playgroud) 由于Anki不支持jQuery,我如何在这个特定文档上转换jQuery,以便在vanilla JS中生成相同的效果,或者纯粹在CSS3中生成(特别是+按钮,并且在单击列表项时)?
$(document).ready(function () {
$("#show-pronunciation").on("click", function () {
$(".pronunciation").slideToggle();
});
$("li").on("click", function () {
$(this).find("dl").slideToggle();
});
});Run Code Online (Sandbox Code Playgroud)
body {
font-family: Avenir, Futura, sans-serif;
background-color: #f7f7f7;
}
.definitions dl {
border-left: 2px solid #ff1919;
padding-left: 5px;
}
dt {
font-weight: bold;
}
dd {
margin-left: 1em;
}
.main {
margin: 20px 20px 0 20px;
border: transparent;
border-radius: 5px;
/*padding: 15px 10px 5px 10px;*/
border-collapse: collapse;
background-color: #FF4C4C;
padding-bottom: 5px;
}
.header {
border-radius: 5px;
padding: 5px;
background-color: white;
}
.content …Run Code Online (Sandbox Code Playgroud)