trretretret commited on
Commit
4f397cc
·
1 Parent(s): f5e7c6b

ctl enter to focus editor

Browse files
Files changed (2) hide show
  1. public/notebin.js +10 -1
  2. public/utils.js +2 -2
public/notebin.js CHANGED
@@ -90,7 +90,7 @@ window.tuieditor = window.editor = new toastui.Editor({
90
 
91
  setTimeout(() => {
92
 
93
- tuieditor.focus();
94
  tuieditor.moveCursorToStart(true);
95
 
96
  window.tuieditor.mdEditor.el.addEventListener('focus', (event) => {
@@ -112,6 +112,15 @@ window.tuieditor.mdEditor.el.addEventListener('keydown', function(event) {
112
  }
113
  });
114
 
 
 
 
 
 
 
 
 
 
115
  let url_div=document.querySelector('#url_div');
116
  url_div.innerText=window.location.href;
117
  url_div.addEventListener('click',()=>{
 
90
 
91
  setTimeout(() => {
92
 
93
+ // tuieditor.focus();
94
  tuieditor.moveCursorToStart(true);
95
 
96
  window.tuieditor.mdEditor.el.addEventListener('focus', (event) => {
 
112
  }
113
  });
114
 
115
+ document.body.addEventListener('keydown', event=>{
116
+ if (event.key === 'Enter' && event.ctrlKey) {
117
+ // Your code here
118
+ tuieditor.mdEditor.focus();
119
+
120
+ console.log('body Ctrl + Enter was pressed:');
121
+ }
122
+ });
123
+
124
  let url_div=document.querySelector('#url_div');
125
  url_div.innerText=window.location.href;
126
  url_div.addEventListener('click',()=>{
public/utils.js CHANGED
@@ -736,7 +736,7 @@ const utils = {
736
 
737
  container.style.zIndex = "100000";
738
  container.style.position = "fixed";
739
- container.style.top = "85vh";
740
  container.style.left = "0";
741
  container.style.height = "40vh";
742
  container.style.width = "80vw";
@@ -839,7 +839,7 @@ const utils = {
839
 
840
  async AIComplete(userText, option = {
841
  url: '/openai/v1/chat/completions',
842
- model: 'llama3-8b-8192',
843
  max_tokens: 8000,
844
  }) {
845
  console.log("AIcomplete(): ", userText);
 
736
 
737
  container.style.zIndex = "100000";
738
  container.style.position = "fixed";
739
+ container.style.top = "70vh";
740
  container.style.left = "0";
741
  container.style.height = "40vh";
742
  container.style.width = "80vw";
 
839
 
840
  async AIComplete(userText, option = {
841
  url: '/openai/v1/chat/completions',
842
+ model: 'llama3-70b-8192',
843
  max_tokens: 8000,
844
  }) {
845
  console.log("AIcomplete(): ", userText);