MCPcopy Create free account
hub / github.com/TruthHun/BookStack / element

Function element

static/editor.md/lib/codemirror/mode/tiki/tiki.js:229–248  ·  view source on GitHub ↗
(type)

Source from the content-addressed store, hash-verified

227}
228
229function element(type) {
230 if (type == "openPlugin") {curState.pluginName = pluginName; return cont(attributes, endplugin(curState.startOfLine));}
231 else if (type == "closePlugin") {
232 var err = false;
233 if (curState.context) {
234 err = curState.context.pluginName != pluginName;
235 popContext();
236 } else {
237 err = true;
238 }
239 if (err) setStyle = "error";
240 return cont(endcloseplugin(err));
241 }
242 else if (type == "string") {
243 if (!curState.context || curState.context.name != "!cdata") pushContext("!cdata");
244 if (curState.tokenize == inText) popContext();
245 return cont();
246 }
247 else return cont();
248}
249
250function endplugin(startOfLine) {
251 return function(type) {

Callers

nothing calls this directly

Calls 5

endpluginFunction · 0.85
endclosepluginFunction · 0.85
contFunction · 0.70
popContextFunction · 0.70
pushContextFunction · 0.70

Tested by

no test coverage detected