c8455d34d4
* Toying with insert and update helpers before translation func * Working prototype that lets you switch between json and tabular * No longer add the bonus items row in json mode * Trimmed the ivy from the codemirror (#13503) * Trimmed the ivy from the codemirror * editedJSONItems removal * De-debugger * Replaced other instances of IvyCodeMirror throughout the app (#13528) * Replaced other instances of IvyCodeMirror throughout the app * PR requests for codemirror modifier * Screen reader setting as param * Trying a simpler codemirror test helper * Lint removal * Screen Reader Label added for a11y * JSONViewer cleanup * JSON editor added to /new and all variables stringified before save or translate * Give users a foothold when editing an empty item in JSON mode * Copy the empty KV * No duplicate keys in KV * Better handling of cursor snapping in json edit field * Catch formatting errors on the fly * Basic tests for JSON to Table and Table to JSON in form
20 lines
528 B
JavaScript
20 lines
528 B
JavaScript
export function getCodeMirrorInstance() {
|
|
return function () {
|
|
return document.querySelector('.CodeMirror').CodeMirror;
|
|
};
|
|
}
|
|
|
|
export default function setupCodeMirror(hooks) {
|
|
hooks.beforeEach(function () {
|
|
this.getCodeMirrorInstance = getCodeMirrorInstance(this.owner);
|
|
|
|
// Expose to window for access from page objects
|
|
window.getCodeMirrorInstance = this.getCodeMirrorInstance;
|
|
});
|
|
|
|
hooks.afterEach(function () {
|
|
delete window.getCodeMirrorInstance;
|
|
delete this.getCodeMirrorInstance;
|
|
});
|
|
}
|