1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-01-30 02:44:44 +00:00
TiddlyWiki5/plugins/tiddlywiki/codemirror-mode-x-tiddlywiki/files/mode/tiddlywiki/tiddlywiki.js
BurningTreeC 3d64d7d126 CodeMirror 5.36.0 modularized (#3184)
* v5.35.1

* codemirror 5.35.1

* v5.35.1

* v5.35.1

* v5.35.1

* v5.35.1

* v5.35.1

* adding search&replace and autocomplete

* update version number

* add jump-to-line.js required for search&replace

* adding show-hint.js required by autocomplete

* adding basic autocomplete for any word

* adding autocomplete css

* adding new files to tiddlywiki.files

* forgot adding search.js

* minify 'em all

* Delete vim.js

* Delete sublime.js

* Delete emacs.js

* Delete anyword-hint.js

* Delete show-hint.css

* Delete show-hint.js

* Update config.tid

* Update tiddlywiki.files

* Update tiddlywiki.files

* Update config.tid

* Update config.tid

* Update config.tid

* Delete dialog.js

* Delete dialog.css

* Delete jump-to-line.js

* Delete search.js

* Delete searchcursor.js

* Update tiddlywiki.files

* Update tiddlywiki.files

* Update tiddlywiki.files

* add search-and-replace cm-addon as plugin

* add autocomplete cm-addon as plugin

* add fullscreen-editing cm-addon as plugin

* add keymaps as plugins + cleanup

* add highlighting modes as plugins

* small update on usage.tid

* moved multiplex.js to htmlembedded mode - the only one using it

* config/CodeMirror update

* how to disable line numbers

* how to change CM theme

* add closebrackets and closetags addons

* packaging a base-addon

* move meta.js from codemirror to base addon

* inputStyle: textarea -> prevents contenteditable on mobile browsers, keeps focus when clicking toolbar buttons, prevents import on paste

* default config no line numbers

* temporary add panel plugin for demo

* put base-plugin back to codemirror editor

* searchcursor to searchnreplace plugin

* bad copypasta mistake

* another typo

* stripped down meta.js + moved matchbrackets to closebrackets plugin

* remove panel

* change module-type to codemirro and make init "require" dynamic.

* make config handling dynamic with sensible defaults

* make cm settings translateable

* delete multids. they will be replaced

* add auto-config tiddlers

* dynamically create config structure for CM

* fix filename

* change typo

* kitchensink config, plus change plugin description for better sorting.

* add matchBrackets config tiddler

* RIP codeblock

* removed install instructions from readme - codemirror usage tiddler still todo

* control panel settings for cm base

* add setting for auto-close tags

* adding fontfamily settings and theme settings

* change tags for settings from $:/tags/ControlPanel/Settings to $:/tags/ControlPanel/Settings/CodeMirror

* more usage info

* more usage info

* update to v5.36.0

* ugly hack enables highlighting and tag-closing for vnd.tiddlywiki and x-tiddlywiki

* disable auto-indent for vnd.tiddlywiki & x-tiddlywiki and add some hidden settings

* remove engine.js hack

* meta.js -> tw-meta.js

* codemirror settings tab

* rename tiddler to tw-meta.js

* make editor font monospace or sans-serif - dropdown select

* make editor font monospace or sans-serif - dropdown select

* now using correct tiddler for editor font setting

* better usage doc

* make markdown-mode require tw-meta

* add more themes info

* add active-line highlighting option

* mini usage change

* add integer type to engine.js config-getter

* blink rate config type string

* correct engine.js

* license for base-plugin, usage link in settings tab

* codemirrordemo hellothere update

* codemirrordemo hellothere update

* Update license.tid

* codemirror demo sidebarlayout, license

* license headers to addon files

* license formatting & forgot what year we have

* license formatting & forgot what year we have & codemirror demo sitetitle sitesubtitle

* more informations 'try-this-style' for codemirrordemo hellothere

* codemirror demo sitetitle & cm fontfamily

* hellothere

* font-family setting must be editor-font-family, not code-font-family

* add basic keyboard shortcuts table

* shortcuts change to not interfere with toolbar shortcuts - needs testing - vim and emacs todo

* formatting

* controlpanel change keymap - default keymap is default

* ctrl-T becomes Alt-T in default keymap

* adjustments for codemirror demo

* demo: hellothere - hint for sidebar keymap cheatsheet

* toolbar focus fix + remove console log

* engine.js cleanup

* formatting

* reverting focus fix

* indenting engine.js

* hoping that indenting gets better
2018-04-06 17:34:50 +01:00

3 lines
3.1 KiB
JavaScript
Executable File

// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("tiddlywiki",function(){var e={},t={allTags:!0,closeAll:!0,list:!0,newJournal:!0,newTiddler:!0,permaview:!0,saveChanges:!0,search:!0,slider:!0,tabs:!0,tag:!0,tagging:!0,tags:!0,tiddler:!0,timeline:!0,today:!0,version:!0,option:!0,with:!0,filter:!0},r=/[\w_\-]/i,n=/^\-\-\-\-+$/,i=/^\/\*\*\*$/,o=/^\*\*\*\/$/,u=/^<<<$/,a=/^\/\/\{\{\{$/,f=/^\/\/\}\}\}$/,c=/^<!--\{\{\{-->$/,m=/^<!--\}\}\}-->$/,l=/^\{\{\{$/,k=/^\}\}\}$/,d=/.*?\}\}\}/;function h(e,t,r){return t.tokenize=r,r(e,t)}function s(t,k){var d=t.sol(),s=t.peek();if(k.block=!1,d&&/[<\/\*{}\-]/.test(s)){if(t.match(l))return k.block=!0,h(t,k,$);if(t.match(u))return"quote";if(t.match(i)||t.match(o))return"comment";if(t.match(a)||t.match(f)||t.match(c)||t.match(m))return"comment";if(t.match(n))return"hr"}if(t.next(),d&&/[\/\*!#;:>|]/.test(s)){if("!"==s)return t.skipToEnd(),"header";if("*"==s)return t.eatWhile("*"),"comment";if("#"==s)return t.eatWhile("#"),"comment";if(";"==s)return t.eatWhile(";"),"comment";if(":"==s)return t.eatWhile(":"),"comment";if(">"==s)return t.eatWhile(">"),"quote";if("|"==s)return"header"}if("{"==s&&t.match(/\{\{/))return h(t,k,$);if(/[hf]/i.test(s)&&/[ti]/i.test(t.peek())&&t.match(/\b(ttps?|tp|ile):\/\/[\-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i))return"link";if('"'==s)return"string";if("~"==s)return"brace";if(/[\[\]]/.test(s)&&t.match(s))return"brace";if("@"==s)return t.eatWhile(r),"link";if(/\d/.test(s))return t.eatWhile(/\d/),"number";if("/"==s){if(t.eat("%"))return h(t,k,b);if(t.eat("/"))return h(t,k,v)}if("_"==s&&t.eat("_"))return h(t,k,w);if("-"==s&&t.eat("-")){if(" "!=t.peek())return h(t,k,x);if(" "==t.peek())return"brace"}return"'"==s&&t.eat("'")?h(t,k,p):"<"==s&&t.eat("<")?h(t,k,z):(t.eatWhile(/[\w\$_]/),e.propertyIsEnumerable(t.current())?"keyword":null)}function b(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=s;break}n="%"==r}return"comment"}function p(e,t){for(var r,n=!1;r=e.next();){if("'"==r&&n){t.tokenize=s;break}n="'"==r}return"strong"}function $(e,t){var r=t.block;return r&&e.current()?"comment":!r&&e.match(d)?(t.tokenize=s,"comment"):r&&e.sol()&&e.match(k)?(t.tokenize=s,"comment"):(e.next(),"comment")}function v(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=s;break}n="/"==r}return"em"}function w(e,t){for(var r,n=!1;r=e.next();){if("_"==r&&n){t.tokenize=s;break}n="_"==r}return"underlined"}function x(e,t){for(var r,n=!1;r=e.next();){if("-"==r&&n){t.tokenize=s;break}n="-"==r}return"strikethrough"}function z(e,r){if("<<"==e.current())return"macro";var n=e.next();return n?">"==n&&">"==e.peek()?(e.next(),r.tokenize=s,"macro"):(e.eatWhile(/[\w\$_]/),t.propertyIsEnumerable(e.current())?"keyword":null):(r.tokenize=s,null)}return{startState:function(){return{tokenize:s}},token:function(e,t){return e.eatSpace()?null:t.tokenize(e,t)}}}),e.defineMIME("text/x-tiddlywiki","tiddlywiki")});