UNPKG

406 BJavaScriptView Raw
1"use strict";
2
3/**
4 * Test if current selection is in a code block.
5 * @param {State} state
6 * @return {Boolean}
7 */
8function isInCodeBlock(opts, state) {
9 var document = state.document,
10 startKey = state.startKey;
11
12 var codeBlock = document.getClosest(startKey, function (block) {
13 return block.type === opts.containerType;
14 });
15
16 return Boolean(codeBlock);
17}
18
19module.exports = isInCodeBlock;
\No newline at end of file