Last active
June 8, 2022 07:32
-
-
Save thykka/53b1e602131a0c86a28bc62a116b9f18 to your computer and use it in GitHub Desktop.
Revisions
-
thykka revised this gist
Jun 8, 2022 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,14 +1,15 @@ // ==UserScript== // @name Stage / CodeMirror Line wrapping // @namespace http://tampermonkey.net/ // @version 0.1.2 // @description Enables line wrapping for CodeMirror, with some responsive tweaks. // @author Moses Holmström // @match https://*.stage.crasman.fi/admin/* // @match https://*.stage.crasman.cloud/admin/* // @grant none // @updateURL https://gist.github.com/thykka/53b1e602131a0c86a28bc62a116b9f18/raw/stage-codemirror-linewrap.user.js // @downloadURL https://gist.github.com/thykka/53b1e602131a0c86a28bc62a116b9f18/raw/stage-codemirror-linewrap.user.js // @icon https://crasman.stage.crasman.fi/favicon.ico // ==/UserScript== (function() { -
thykka revised this gist
Mar 25, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ // ==UserScript== // @name Stage / CodeMirror Line wrapping // @namespace http://tampermonkey.net/ // @version 0.1.1 // @description Enables line wrapping for CodeMirror, with some responsive tweaks. // @author Moses Holmström // @match https://*.stage.crasman.fi/admin/* -
thykka revised this gist
Mar 25, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ // ==UserScript== // @name Stage / CodeMirror Line wrapping // @namespace http://tampermonkey.net/ // @version 0.1 // @description Enables line wrapping for CodeMirror, with some responsive tweaks. -
thykka revised this gist
Mar 25, 2022 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,6 +7,8 @@ // @match https://*.stage.crasman.fi/admin/* // @match https://*.stage.crasman.cloud/admin/* // @grant none // @updateURL https://gist.github.com/thykka/53b1e602131a0c86a28bc62a116b9f18/raw/stage-codemirror-linewrap.user.js // @downloadURL https://gist.github.com/thykka/53b1e602131a0c86a28bc62a116b9f18/raw/stage-codemirror-linewrap.user.js // ==/UserScript== (function() { -
thykka created this gist
Mar 25, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,42 @@ // ==UserScript== // @name Stage CodeMirror Line wrapping // @namespace http://tampermonkey.net/ // @version 0.1 // @description Enables line wrapping for CodeMirror, with some responsive tweaks. // @author Moses Holmström // @match https://*.stage.crasman.fi/admin/* // @match https://*.stage.crasman.cloud/admin/* // @grant none // ==/UserScript== (function() { 'use strict'; // Constrain editor to screen width document.body.style.minWidth = '0'; document.getElementById('workarea').style.minWidth = '0'; document.querySelectorAll("#dialog-context,#workarea").forEach(el => { el.addEventListener("DOMSubtreeModified", ev => { const cmInstance = ev.target.closest('.CodeMirror'); if(!cmInstance) return; // wrong element if(cmInstance.dataset?.lineWrapInitialized) return; if(!cmInstance.CodeMirror) return; // not initialized if(!cmInstance.CodeMirror.state) return; // ghost editor const uiComponent = cmInstance.closest('.ui-component-codemirror'); if(!uiComponent) return; uiComponent.style.maxWidth = '100vw'; cmInstance.CodeMirror.setOption('lineWrapping', true); cmInstance.dataset.lineWrapInitialized = true; }); }); document.querySelectorAll('.CodeMirror').forEach(cm => { cm.CodeMirror.setOption('lineWrapping', true); }); })();