MCPcopy Create free account
hub / github.com/cweijan/vscode-office / isCmCodeBlock

Function isCmCodeBlock

vditor/src/ts/codeBlock/codeMirrorManager.ts:181–196  ·  view source on GitHub ↗
(blockElement: HTMLElement | null)

Source from the content-addressed store, hash-verified

179};
180
181export const isCmCodeBlock = (blockElement: HTMLElement | null) => {
182 if (!blockElement) {
183 return false;
184 }
185 const dataType = blockElement.getAttribute("data-type");
186 if (!dataType || !CM_BLOCK_DATA_TYPES.has(dataType)) {
187 return false;
188 }
189 if (!getBlockParts(blockElement)) {
190 return false;
191 }
192 if (isSpecialBlock(blockElement)) {
193 return blockElement.classList.contains(CM_EDITING_CLASS);
194 }
195 return true;
196};
197
198/** @deprecated use isCmCodeBlock */
199export const isWysiwygCmCodeBlock = isCmCodeBlock;

Callers 15

inputFunction · 0.90
bindEventMethod · 0.90
processKeydownFunction · 0.90
highlightToolbarWYSIWYGFunction · 0.90
inputFunction · 0.90
bindEventMethod · 0.90
processKeydownFunction · 0.90
HintClass · 0.90
listIndentFunction · 0.90
listOutdentFunction · 0.90
processCodeRenderFunction · 0.90

Calls 5

getBlockPartsFunction · 0.85
isSpecialBlockFunction · 0.85
getAttributeMethod · 0.80
hasMethod · 0.65
containsMethod · 0.45

Tested by

no test coverage detected