您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Sets the cursor position to the start of the input field rather than the end when switching to Code View in Kanka
- // ==UserScript==
- // @name Kanka Summernote Code View to the Top
- // @namespace http://tampermonkey.net/
- // @version 2
- // @description Sets the cursor position to the start of the input field rather than the end when switching to Code View in Kanka
- // @author Salvatos
- // @match https://app.kanka.io/*
- // @match https://marketplace.kanka.io/*
- // @icon https://www.google.com/s2/favicons?domain=kanka.io
- // @run-at document-end
- // ==/UserScript==
- // Wait for Summernote to initialize
- $('#entry').on('summernote.init', function() {
- // Add event to code view toggle
- document.getElementsByClassName('btn-codeview')[0].addEventListener('click', cursorToTop);
- });
- function cursorToTop() {
- // Run only when in code view
- if ($('#entry + div').hasClass('codeview')) {
- // Find editor
- const codeEditor = document.getElementsByClassName('note-codable')[0];
- // Selection to 0
- codeEditor.setSelectionRange(0,0);
- }
- }
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址