1 | ;
|
2 |
|
3 | /**
|
4 | * Test if current selection is in a code block.
|
5 | * @param {State} state
|
6 | * @return {Boolean}
|
7 | */
|
8 | function 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 |
|
19 | module.exports = isInCodeBlock; |
\ | No newline at end of file |