function getFreshSourceCode()

in playground/tree-sitter/concrete-syntax.js [307:326]


function getFreshSourceCode() {
    if (window.playground && window.playground.codeEditor) {
        return window.playground.codeEditor.getValue();
    }
    
    // Fallback to CodeMirror search
    const codeMirrorElements = document.querySelectorAll('.CodeMirror');
    for (let cm of codeMirrorElements) {
        if (cm.CodeMirror && cm.CodeMirror.getValue) {
            const code = cm.CodeMirror.getValue();
            if (code && code.trim()) {
                return code;
            }
        }
    }
    
    // Last fallback to textarea
    const codeInput = document.getElementById('code-input');
    return codeInput?.value || '';
}