Closed saturngod closed 10 years ago
I want to add ace editor in markdown. However, ace.js always call at the end of the page.
Example like following,
<body> ..... <script> var editor = ace.edit('code'); </script> .... .... ... <script src="../gitbook/plugins/pywebtest-gitbook/editor/ace.js"></script> </body>
ace.js at the bottom. So, ace.edit can't use anymore because ace object didn't found.
I try to use with
document.addEventListener('DOMContentLoaded', function(){ var editor = ace.edit('code'); })
It's not working with ajax call. But working with direct URL or refresh the page.
When navigate , ajax call and change the page. So, DOMContentLoaded is not working.
If I can put ace.js after <body> , it will be better and no need DOMContentLoaded any more.
<body>
Fixed base on https://github.com/GitbookIO/plugin-mixpanel code.
I use like following
gitbook.events.bind("page.change", function() { load_editor(); });
I want to add ace editor in markdown. However, ace.js always call at the end of the page.
Example like following,
ace.js at the bottom. So, ace.edit can't use anymore because ace object didn't found.
I try to use with
It's not working with ajax call. But working with direct URL or refresh the page.
When navigate , ajax call and change the page. So, DOMContentLoaded is not working.
If I can put ace.js after
<body>
, it will be better and no need DOMContentLoaded any more.