File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 190190 <td >
191191 <code >[Title](https://example.org)</code >
192192 </td >
193- <td v-if =" !isMobileCached" />
193+ <td v-if =" !isMobileCached" >
194+ <kbd >{{ ctrlOrModKey }}</kbd >
195+ +
196+ <kbd >K</kbd >
197+ </td >
194198 </tr >
195199 <tr >
196200 <td >{{ t('text', 'Insert emoji') }}</td >
Original file line number Diff line number Diff line change 6767
6868 <!-- link edit form -->
6969 <div v-if =" isEditable && edit" class =" link-view-bubble__edit" >
70- <NcTextField name =" newHref"
70+ <NcTextField ref =" hrefField"
71+ name =" newHref"
7172 :label =" t('text', 'URL')"
7273 :value.sync =" newHref"
7374 @keypress.enter.prevent =" updateLink" />
@@ -174,6 +175,7 @@ export default {
174175 watch: {
175176 key () {
176177 this .resetBubble ()
178+ this .startEditIfEmpty ()
177179 },
178180 },
179181
@@ -184,6 +186,10 @@ export default {
184186 })
185187 },
186188
189+ mounted () {
190+ this .startEditIfEmpty ()
191+ },
192+
187193 methods: {
188194 t,
189195
@@ -204,6 +210,15 @@ export default {
204210 startEdit () {
205211 this .edit = true
206212 this .newHref = this .href
213+ this .$nextTick (() => {
214+ this .$refs .hrefField .focus ()
215+ })
216+ },
217+
218+ startEditIfEmpty () {
219+ if (this .isEditable && ! this .href ) {
220+ this .startEdit ()
221+ }
207222 },
208223
209224 stopEdit () {
Original file line number Diff line number Diff line change @@ -400,6 +400,8 @@ export const MenuEntries = [
400400 {
401401 key : 'insert-link' ,
402402 label : t ( 'text' , 'Insert link' ) ,
403+ keyChar : 'k' ,
404+ keyModifiers : [ MODIFIERS . Mod ] ,
403405 isActive : 'link' ,
404406 icon : LinkIcon ,
405407 component : ActionInsertLink ,
Original file line number Diff line number Diff line change @@ -88,6 +88,20 @@ const Link = TipTapLink.extend({
8888 ]
8989 } ,
9090
91+ addKeyboardShortcuts ( ) {
92+ return {
93+ 'Mod-k' : ( ) => {
94+ const { empty } = this . editor . state . selection
95+ if ( empty ) {
96+ console . debug ( 'empty selection' )
97+ return false
98+ }
99+ console . debug ( 'toggle link for selection' )
100+ return this . editor . commands . toggleLink ( { href : '' } )
101+ } ,
102+ }
103+ } ,
104+
91105 addProseMirrorPlugins ( ) {
92106 const plugins = this . parent ( )
93107 // remove upstream link click handle plugin
You can’t perform that action at this time.
0 commit comments