最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Full screen Ace editor - Stack Overflow

programmeradmin2浏览0评论

I'm trying to make my ace editor go full screen mode, just like youtube has the possibility to make it's videos full screen.

Does anyone have an idea of how to do this?

I'm trying to make my ace editor go full screen mode, just like youtube has the possibility to make it's videos full screen.

Does anyone have an idea of how to do this?

Share Improve this question edited Jul 26, 2014 at 7:20 Johnny Willemsen 3,0021 gold badge16 silver badges17 bronze badges asked Jul 17, 2014 at 20:02 DoronDoron 1712 gold badges5 silver badges13 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 2

You need to resize editor.container to cover the whole page and call editor.resize().
something like this

To enter real fullscreen mode like youtube use editor.container.webkitRequestFullscreen() see https://developer.mozilla/en-US/docs/Web/Guide/API/DOM/Using_full_screen_mode Unfortunately in fullscreen mode browser captures esc key, so this won't be usable with multiple selections.

2024+ update. You can use the code below to fire up fullscreen mode on F12 key press. Just adjust the editors[editor_instance] so it points to your Ace editor object.

editors[editor_instance].mands.addCommand({
    name: "save",
    bindKey: { win: "F12" },
    exec: function(editor) {
        editor.container.requestFullscreen();
    }
});
发布评论

评论列表(0)

  1. 暂无评论