Commit Graph

165 Commits

Author SHA1 Message Date
tophf
5d52a7ec2e Editor: "findNext" after page load should call "find" 2015-09-01 10:54:56 +03:00
Jason Barnabe
718d2e0f86 Merge pull request #149 from tophf/dim-save-button
Editor: disable "Save" button when content is unmodified
2015-08-30 11:36:17 -05:00
tophf
256177844b Editor: disable "Save" button when content is unmodified 2015-08-30 19:16:41 +03:00
tophf
d2441213ef Don't use css calc with vw as it fails on Chrome 31
* Also makes showCodeMirrorPopup() size stylable
2015-08-28 19:45:15 +03:00
Jason Barnabe
0c30be4544 Merge pull request #132 from tophf/paste-mozilla
Editor: paste from Mozilla format
2015-08-24 17:23:54 -05:00
tophf
5802cc4ae6 refactor/deduplicate "#sections > div" handling 2015-08-24 08:16:23 +03:00
tophf
0ead2ef259 Editor: paste from Mozilla format; export in styled popup 2015-08-24 08:16:22 +03:00
tophf
55c48d62fc Editor: escape html in CSSLint report, limit message length 2015-08-07 17:19:09 +03:00
Jason Barnabe
7f0557df57 Merge pull request #143 from tophf/fixes
Fixes
2015-08-04 22:37:17 -05:00
tophf
78fea74a0e Editor: update CSSLint report ASAP once an issue is fixed 2015-08-03 19:34:47 +03:00
tophf
cb366cf9d7 fixup 1ad9200: don't overwrite the initial lint delay 2015-08-03 18:54:03 +03:00
tophf
ea18ae2c89 Editor: avoid flicker of "Edit style" heading on load 2015-08-03 08:13:01 +03:00
tophf
4f61494e0d Move html templates to html file 2015-08-03 08:13:01 +03:00
tophf
20141b7bfa Editor: add global-replace/replaceAll commands
* Collateral fix: correctly restore openDialog() after Esc
* refactor html templates
2015-08-03 08:12:39 +03:00
tophf
1ad92001c0 Editor: less obtrusive CSSLint reporting in header, wait ~5s
* Keep the old timeout after page init ~500ms
* Immediately show the report in onbeforeunload and save
2015-08-02 18:11:15 +03:00
tophf
e1b8b48980 Editor: only attach hotkey rerouter when leaving codebox 2015-08-02 17:17:20 +03:00
tophf
6d5637e69a Editor: faster page load 2015-08-01 15:13:52 +03:00
tophf
ae8683873a fixes for Chrome 31 2015-08-01 15:11:32 +03:00
tophf
0cb7936fd3 Editor: better Undo in CSS-Beautify 2015-07-04 09:40:07 +03:00
tophf
be8552dcf6 typo 2015-07-04 09:04:04 +03:00
tophf
c3472207bf Editor: add Undo button to CSS-beautifier 2015-07-04 06:39:39 +03:00
tophf
5caab7ab47 Editor: better async adding of sections in initWithStyle 2015-07-04 06:39:39 +03:00
tophf
b5df8802a0 Editor: CSS-beautifier 2015-07-04 06:39:39 +03:00
tophf
1250bb970e Editor: show a list of all CSSLint messages 2015-07-04 06:33:40 +03:00
Jason Barnabe
c61b715e2f Merge pull request #124 from tophf/manage-scroll-save
Manage: remember scroll position, initialize styles earlier
2015-06-19 22:58:29 -05:00
Jason Barnabe
4d768d8740 Merge pull request #128 from tophf/empty-code-section
Editor: show an empty code box for styles with no sections
2015-06-19 21:39:44 -05:00
tophf
8b890e8652 Editor: don't save window size after browser restart
Because if an edit style window was the only window open when closing the browser it'll become the main browser window after restart and is likely to be resized differently.
2015-06-15 18:56:48 +03:00
tophf
67fe43e9a9 Editor: use history back for Back-To-Manage when appropriate 2015-06-10 17:18:13 +03:00
tophf
f48c0da63f Editor: show an empty code box for styles with no sections 2015-06-10 13:03:41 +03:00
tophf
ac88689533 Editor: set OS-dependent default keymap consistently 2015-06-10 12:58:01 +03:00
Jason Barnabe
761b5bd7d9 Merge pull request #123 from tophf/editor-fixes
Editor: fixes
2015-06-09 21:27:54 -05:00
Jason Barnabe
1c6004cbfb Merge pull request #122 from tophf/editor-hl-cmt
Editor: highlight active line, add toggle/line/block comment commands
2015-06-09 21:11:08 -05:00
tophf
3429db0ee1 Editor: correctly determine when to save the window size 2015-06-04 15:22:05 +03:00
tophf
2895ce11e2 Editor: maximize height of code boxes on start when possible 2015-06-04 13:43:04 +03:00
tophf
03c9b04503 Editor: add toggle/line/block comment commands 2015-05-27 21:03:25 +03:00
tophf
0308774fc4 Editor: highlight active line 2015-05-27 21:03:25 +03:00
tophf
39021be48c Editor: add a link to the install source page 2015-05-15 19:49:56 +03:00
Jason Barnabe
28e34f2990 Merge pull request #114 from tophf/respect-user-extrakeys
Respect localStorage::editor.extraKeys user option
2015-05-14 14:47:41 -05:00
tophf
7f5580a661 Editor: press a hotkey in keymap help table to filter it
Add localizable placeholders to inputboxes
2015-05-14 22:44:28 +03:00
tophf
992f2bb38f Respect localStorage::editor.options.extraKeys user option 2015-05-14 00:06:46 +03:00
tophf
9979f43b09 Editor: search in 'applies-to' inputs too 2015-05-10 12:40:52 +03:00
tophf
932ffa80fe Editor: use visible code box for 'find' when focused one is offscreen 2015-05-10 12:40:51 +03:00
tophf
532662672f Editor: repaint code boxes on window scroll 2015-05-10 12:40:51 +03:00
tophf
eb9e045308 Editor: Shift-Ctrl-Wheel to scroll entire page 2015-05-10 12:40:51 +03:00
tophf
e707a08a84 Editor: showHelp() as html, add help for hotkeys 2015-05-10 12:40:51 +03:00
tophf
9ae6382469 Editor: remove scroll-hack and hint-hack, not needed with CM5.2.1 2015-05-10 12:40:51 +03:00
tophf
614694cf7e Editor: reroute browser hotkeys to CM using keymaps 2015-05-10 12:40:51 +03:00
tophf
a830d5b3af Editor: use current search state in later added sections 2015-05-10 12:40:49 +03:00
tophf
62ec9e1c9e Editor: make newly added section visible 2015-05-06 09:13:28 +03:00
tophf
539be4ce43 Code review & cosmetics 2015-05-05 23:42:38 +03:00
tophf
a0c5674f6f Wait for background page to load on Chrome startup
At startup Chrome lazy-loads extension's background page,
thus occasionally breaking apply.js and Stylish own pages
2015-05-05 21:36:16 +03:00
tophf
bc6476bc52 Editor: option to select CodeMirror CSS theme 2015-05-05 21:14:11 +03:00
tophf
9efac32b85 Localize search prompts in editor 2015-05-01 13:33:01 +03:00
tophf
0e6f63951a Localization: embed in html, autorun, apply earlier 2015-05-01 13:33:01 +03:00
tophf
1156b3f989 Fix 'const in strict mode' error in very old Chrome 2015-04-22 14:30:55 +03:00
Jason
f8c0c5bf80 Fix dirty when undoing after save 2015-04-08 13:24:26 -05:00
tophf
d4382d3f08 Apply global changes to popups 2015-04-07 20:07:45 +03:00
tophf
451b392034 Editor: when in applies-to, use its code box for search 2015-03-29 18:58:57 +03:00
Jason Barnabe
4aff58d4ba Merge pull request #88 from tophf/chrome-hotkeys
Add Chrome shortcut keys; update all visible popups on change; add 2 prefs to toolbar button menu
2015-03-26 13:16:55 -05:00
tophf
827a324297 Editor: auto-adjust vertical scrollbar margin for resize grip 2015-03-26 14:12:47 +03:00
tophf
413c454713 Editor: reroute the browser search to a closest CodeMirror box
Won't work if invoked via the browser menu or a non-standard hotkey
2015-03-26 14:12:47 +03:00
tophf
2ed53db7ad Add Chrome shortcut keys; update popups on change
* hotkey to open Manage styles
* hotkey to enable/disable all styles

No default hotkeys are provided, to customize go to "Keyboard shortcuts" on the Extensions page
2015-03-25 18:04:51 +03:00
tophf
a4f602c7aa Editor: add resize grip 2015-03-25 16:42:11 +03:00
tophf
9c99495d65 Editor: webkit columns bug workaround; better alignment; rem units 2015-03-24 19:16:16 +03:00
tophf
e0650fde71 Editor: fixes for 0e391f9, refactor, more fixes
* recognize changes in applies-to inputs
* recognize changes only in specified controls
* forget the dirty applies-to ids from a deleted section after the style was saved
* toMozillaFormat: use the actual contents of CodeMirror instances
* toMozillaFormat: allow empty code section with non-empty applies-to
* refactor: simplify, de-kludge, de-duplicate, de-obfuscate, use more descriptive names instead of "items", "a", "b" where appropriate
2015-03-21 20:09:58 +03:00
tophf
3ad6fd974b Editor: fix findNext to not display Chrome's findbar 2015-03-21 05:53:59 +03:00
tophf
fec5306037 Editor: make Ctrl-S work in input boxes 2015-03-20 17:27:21 +03:00
tophf
603da2736f Editor: don't scroll sections into view on click 2015-03-20 17:27:21 +03:00
tophf
31a9be7c2a Editor: add "!important" word to autocomplete in css properties 2015-03-20 17:27:21 +03:00
tophf
ed9ce87d99 Editor: add sections asynchronously on init
Improves perceived responsiveness.
Becomes noticeable with ~3 sections.
Becomes indispensable with ~10 sections.
2015-03-20 17:27:21 +03:00
tophf
374244fceb Editor: remember size/pos only for detached windows 2015-03-20 17:27:20 +03:00
hideheader
4e7b15f491 Report element removals correctly
An element with a `defaultValue` now becomes dirty when removed; elements
without become clean. As a result, removing an existing section makes the
document dirty while removing a new section makes it clean(er).
2015-03-16 16:47:56 -04:00
hideheader
b7483035d5 Flatten the closure, simplify its functions 2015-03-15 16:16:12 -04:00
hideheader
d3f8e38936 Manage dirty flags on all inputs
(1) Record initial value of text, select, and checkbox elements and re/set a
dirty class on each when the value changes.
(2) Combine the individual flags into a global dirty flag.
(3) Add 'dirty' status to the document title.
2015-03-15 14:50:42 -04:00
hideheader
284d4b8ec8 Add editor options
(1) Add UI controls for `keyMap`, `tabSize`, `indentWithTabs`, and
`lineWrapping`; `indentUnit` tracks `tabSize`.
(2) Dispatch `change` events from `loadPrefs` to initialize CM options
from the controls' event listener.
(3) Move stock options from the `CM.fromTextArea` call into `CM.defaults`.
Add `CM.setOption` method, analogous to the instance method, which updates
`CM.defaults` and sets the option in all instances; add `CM.getOption`
which simply returns `CM.defaults[option]`.
(4) Move the new editor functions into `CM.commands` and replace the
functions with commands.
2015-03-15 12:40:38 -04:00
hideheader
ae327d4ee1 Remove eval from css-lint
Evaluate string token with `RegExp.exec()` instead of `eval()`.
2015-03-12 19:35:20 -04:00
Jason Barnabe
83bcde6569 Merge pull request #61 from tophf/global-search-in-new
Edit style: more tweaks
2015-03-12 13:15:46 -05:00
tophf
a5594eb7f1 fixup: actually autofocus the added section 2015-03-12 20:59:45 +03:00
tophf
0be6f6dfe4 Edit style: remove CodeMirror's Ctrl-S handler, now redundant 2015-03-12 20:41:06 +03:00
tophf
55538f808d Edit style: allow adding sections midway, autofocus on manual add 2015-03-12 13:21:11 +03:00
tophf
b7fb1f14e1 Edit style: warn on losing changes to applies-to fields 2015-03-12 13:18:57 +03:00
tophf
464d3eb30d Edit style: save on Ctrl-S outside code blocks too 2015-03-12 13:18:57 +03:00
tophf
c084ea3973 Edit style: retain scroll position of window & editor 2015-03-11 23:31:13 +03:00
tophf
f654cc734f Edit style: remember detached window position and size 2015-03-11 23:31:13 +03:00
tophf
8844b71aab Edit style: fix goto next/prev section after deleting one 2015-03-11 23:31:12 +03:00
hideheader
8140e16474 Fix 'dirty' indicator on 'Code' boxes
Toggle a class on the container instead of changing label text.
2015-03-10 11:45:13 -04:00
tophf
556c8746f6 New style edit: search in all code sections 2015-03-07 06:07:25 +03:00
Jason Barnabe
0bf5a1c748 Merge pull request #59 from tophf/global-search
Search all sections on find, findNext, findPrev when invoked from the editor
2015-03-06 20:08:22 -06:00
Jason Barnabe
9a90e15d45 Merge pull request #57 from tophf/keymap
Edit style: use 'sublime' keymap, add custom keys
2015-03-06 19:57:05 -06:00
tophf
cd8d11b137 Scroll the clicked section into view 2015-03-07 04:06:40 +03:00
tophf
514a1227e4 Search all sections on find/findNext/findPrev 2015-03-07 04:06:40 +03:00
9adefaf01e5bf6426d838cd20eae582d2b6ba647
20123760ac Edit style: use 'sublime' keymap, add custom keys
F3, Shift-F3, Ctrl-H - find/find previous/replace
Ctrl-G: go to line dialog
Alt-PgDn: next code section
Alt-PgUp: previous code section
...and many more.
2015-03-05 09:59:11 +03:00
hideheader
279c5a2328 Create new styles with url-prefix()
`url-prefix()` is used ca. 100 times as often as `url()`.
2015-03-04 12:03:28 -05:00
Jason Barnabe
ab36efdd71 Merge pull request #50 from tophf/unsaved-code-warning
Edit style: warn before losing changes in code areas
2015-03-03 20:55:45 -06:00
hideheader
f54a70fe07 Replace localStorage calls with prefs calls 2015-03-03 18:36:18 -05:00
9adefaf01e5bf6426d838cd20eae582d2b6ba647
0fe98e374c Edit style: warn before losing changes in code areas 2015-03-03 23:44:46 +03:00
Jason Barnabe
110c31d495 Merge pull request #46 from tophf/hotkeys-in-edit
Edit style: add Ctrl-S hotkey to save the style
2015-03-03 14:36:50 -06:00
9adefaf01e5bf6426d838cd20eae582d2b6ba647
e8c5c6dfd4 Edit style: add Ctrl-S hotkey to save the style 2015-03-03 23:26:22 +03:00
9adefaf01e5bf6426d838cd20eae582d2b6ba647
5a0e465f2a Edit style: autocomplete on Ctrl-Space using CodeMirror hint addon 2015-03-03 21:16:24 +03:00
Jason Barnabe
b4173d68f6 Add CodeMirror addons - search, code folding, match brackets, lint 2015-02-24 22:05:00 -06:00