
This adds a merge view to the inline editing screen so that users can diff against the patch set the change edit is based on while editing. This new functionality makes use of CodeMirror's merge view addon, which requires Google's diff-match-patch library to be loaded. The library implements an algorithm based on the Myers diff in JavaScript on the client side, so there is no extra usage of Gerrit's DiffApi. The minified diff-match-patch library is bundled with CodeMirror's merge view addon during the build process. By default, the merge view is disabled. This can be changed via EditPreferencesBox. Also added a checkbox to the EditScreen header to toggle the view. The loading of the content of the base version is lazy - it is only loaded when the merge view is actually used. The documentation and tutorial on this new feature will be added in later changes. Screenshot: https://i.imgur.com/uNMNzjM.png Change-Id: I5eb4af9b67bbfcb0b149965b3c818c1f6118e6de
212 lines
3.1 KiB
Plaintext
212 lines
3.1 KiB
Plaintext
CM_CSS = [
|
|
'lib/codemirror.css',
|
|
'addon/dialog/dialog.css',
|
|
'addon/merge/merge.css',
|
|
'addon/scroll/simplescrollbars.css',
|
|
'addon/search/matchesonscrollbar.css',
|
|
'addon/lint/lint.css',
|
|
]
|
|
|
|
CM_JS = [
|
|
'lib/codemirror.js',
|
|
'mode/meta.js',
|
|
'keymap/emacs.js',
|
|
'keymap/sublime.js',
|
|
'keymap/vim.js',
|
|
]
|
|
|
|
CM_ADDONS = [
|
|
'dialog/dialog.js',
|
|
'edit/closebrackets.js',
|
|
'edit/matchbrackets.js',
|
|
'edit/trailingspace.js',
|
|
'scroll/annotatescrollbar.js',
|
|
'scroll/simplescrollbars.js',
|
|
'search/jump-to-line.js',
|
|
'search/matchesonscrollbar.js',
|
|
'search/searchcursor.js',
|
|
'search/search.js',
|
|
'selection/mark-selection.js',
|
|
'mode/multiplex.js',
|
|
'mode/overlay.js',
|
|
'mode/simple.js',
|
|
'lint/lint.js',
|
|
]
|
|
|
|
# Available themes must be enumerated here,
|
|
# in gerrit-extension-api/src/main/java/com/google/gerrit/extensions/common/Theme.java,
|
|
# in gerrit-gwtui/src/main/java/net/codemirror/theme/Themes.java
|
|
CM_THEMES = [
|
|
'3024-day',
|
|
'3024-night',
|
|
'abcdef',
|
|
'ambiance',
|
|
'base16-dark',
|
|
'base16-light',
|
|
'bespin',
|
|
'blackboard',
|
|
'cobalt',
|
|
'colorforth',
|
|
'dracula',
|
|
'eclipse',
|
|
'elegant',
|
|
'erlang-dark',
|
|
'hopscotch',
|
|
'icecoder',
|
|
'isotope',
|
|
'lesser-dark',
|
|
'liquibyte',
|
|
'material',
|
|
'mbo',
|
|
'mdn-like',
|
|
'midnight',
|
|
'monokai',
|
|
'neat',
|
|
'neo',
|
|
'night',
|
|
'paraiso-dark',
|
|
'paraiso-light',
|
|
'pastel-on-dark',
|
|
'railscasts',
|
|
'rubyblue',
|
|
'seti',
|
|
'solarized',
|
|
'the-matrix',
|
|
'tomorrow-night-bright',
|
|
'tomorrow-night-eighties',
|
|
'ttcn',
|
|
'twilight',
|
|
'vibrant-ink',
|
|
'xq-dark',
|
|
'xq-light',
|
|
'yeti',
|
|
'zenburn',
|
|
]
|
|
|
|
# Available modes must be enumerated here,
|
|
# in gerrit-gwtui/src/main/java/net/codemirror/mode/Modes.java,
|
|
# gerrit-gwtui/src/main/java/net/codemirror/mode/ModeInfo.java,
|
|
# and in CodeMirror's own mode/meta.js script.
|
|
CM_MODES = [
|
|
'apl',
|
|
'asciiarmor',
|
|
'asn.1',
|
|
'asterisk',
|
|
'brainfuck',
|
|
'clike',
|
|
'clojure',
|
|
'cmake',
|
|
'cobol',
|
|
'coffeescript',
|
|
'commonlisp',
|
|
'crystal',
|
|
'css',
|
|
'cypher',
|
|
'd',
|
|
'dart',
|
|
'diff',
|
|
'django',
|
|
'dockerfile',
|
|
'dtd',
|
|
'dylan',
|
|
'ebnf',
|
|
'ecl',
|
|
'eiffel',
|
|
'elm',
|
|
'erlang',
|
|
'factor',
|
|
'fcl',
|
|
'forth',
|
|
'fortran',
|
|
'gas',
|
|
'gfm',
|
|
'gherkin',
|
|
'go',
|
|
'groovy',
|
|
'haml',
|
|
'handlebars',
|
|
'haskell-literate',
|
|
'haskell',
|
|
'haxe',
|
|
'htmlembedded',
|
|
'htmlmixed',
|
|
'http',
|
|
'idl',
|
|
'jade',
|
|
'javascript',
|
|
'jinja2',
|
|
'jsx',
|
|
'julia',
|
|
'livescript',
|
|
'lua',
|
|
'markdown',
|
|
'mathematica',
|
|
'mbox',
|
|
'mirc',
|
|
'mllike',
|
|
'modelica',
|
|
'mscgen',
|
|
'mumps',
|
|
'nginx',
|
|
'nsis',
|
|
'ntriples',
|
|
'octave',
|
|
'oz',
|
|
'pascal',
|
|
'pegjs',
|
|
'perl',
|
|
'php',
|
|
'pig',
|
|
'powershell',
|
|
'properties',
|
|
'protobuf',
|
|
'puppet',
|
|
'python',
|
|
'q',
|
|
'r',
|
|
'rpm',
|
|
'rst',
|
|
'ruby',
|
|
'rust',
|
|
'sas',
|
|
'sass',
|
|
'scheme',
|
|
'shell',
|
|
'sieve',
|
|
'slim',
|
|
'smalltalk',
|
|
'smarty',
|
|
'solr',
|
|
'soy',
|
|
'sparql',
|
|
'spreadsheet',
|
|
'sql',
|
|
'stex',
|
|
'stylus',
|
|
'swift',
|
|
'tcl',
|
|
'textile',
|
|
'tiddlywiki',
|
|
'tiki',
|
|
'toml',
|
|
'tornado',
|
|
'troff',
|
|
'ttcn-cfg',
|
|
'ttcn',
|
|
'turtle',
|
|
'twig',
|
|
'vb',
|
|
'vbscript',
|
|
'velocity',
|
|
'verilog',
|
|
'vhdl',
|
|
'vue',
|
|
'webidl',
|
|
'xml',
|
|
'xquery',
|
|
'yacas',
|
|
'yaml-frontmatter',
|
|
'yaml',
|
|
'z80',
|
|
]
|