Commit graph

4,472 commits

Author SHA1 Message Date
Matthew Kastor
a37b9ac53a adds modelist to extensions
I copied the modelist.js file from the kitchen sink demo and added doc
comments to the exported methods.

This module would be extremely helpful to anyone implementing a menu
system or who wanted to programatically switch rendering modes based on
the file extension of the file loaded into ace. I can think of several
use cases for it already. (1) in the settingsMenu branch. (2) in
supporting theme switching for anyone implementing drag and drop support
for loading files into the editor (3) in supporting theme switching for
sites implementing their own file picker dialogues and loading content
into ace through xmlhttprequest (4) in supporting filebrowser / editor
applications where a server could be set up to display file contents in
an ace editor as users browsed to arbitrary files. (5) etc. etc.

Had I known about it when I began writing the settingsMenu branch I
would have used it.
2013-04-13 20:55:07 +04:00
Matthew Kastor
408b190bb0 refactored settings menu extension 2013-04-13 20:53:41 +04:00
Matthew Kastor
60616deec0 add_editor_menu_options uses themelist to generate theme options 2013-04-13 20:53:41 +04:00
Matthew Kastor
5ea87bd96d themelist consumes themes.js & mimics modelist 2013-04-13 20:53:41 +04:00
Matthew Kastor
2107796de5 autogenerated themes.js during build 2013-04-13 20:53:41 +04:00
Matthew Kastor
dd33d82528 build now generates themes.js
This module simply exports an array of themes available so we can use
it.
2013-04-13 20:53:41 +04:00
Matthew Kastor
47329e944f Merge modelist branch & use it
This branch now depends on the modelist being pulled in as a module. I'm
using the modelist to generate the menu options for switching modes
because it's redundant to have the same massive list in two places.

The modelist module also has some awesome features so I choose it over
my silly list. :D
2013-04-13 20:53:41 +04:00
Matthew Kastor
1a4af9aff9 example code explains extension 2013-04-13 20:52:58 +04:00
nightwing
3adba8eb21 adds demo show_settings_menu
adds keyboard shortcut on init

adds keyboard shortcut on init
2013-04-13 20:52:58 +04:00
Matthew Kastor
7aac105a07 augments Editor.prototype 2013-04-13 20:52:50 +04:00
Matthew Kastor
f5500fefc4 adds demo show_keyboard_shortcuts 2013-04-13 20:52:50 +04:00
Matthew Kastor
d531866663 augments Editor.prototype 2013-04-13 20:52:50 +04:00
Matthew Kastor
b1ac371387 fixes esc event listener removal 2013-04-13 20:52:50 +04:00
nightwing
fb9bc6d3f4 prettifies menu option labels
removes "set" adds space before uppercase letters.

focus handling

focus handling
2013-04-13 20:52:50 +04:00
Matthew Kastor
9e9cdb3c48 removes commands from default commands 2013-04-13 20:52:22 +04:00
Matthew Kastor
0631a708bc removes requires from Editor 2013-04-13 20:49:46 +04:00
Matthew Kastor
b0e496de88 moved utilities to subdirectory 2013-04-13 20:49:46 +04:00
Matthew Kastor
ccae5bd8d5 remove console.log 2013-04-13 20:49:46 +04:00
Matthew Kastor
be52f7316a fix typo 2013-04-13 20:49:46 +04:00
Matthew Kastor
8244231254 adds support for closing menus by pressing esc 2013-04-13 20:49:46 +04:00
Matthew Kastor
0a289d2468 removed left property assignment
When the editor takes up the entire window and the window is only half
the size of my screen, the menus get crunched up horribly.  I'll provide
for closing the overlay by pressing esc in case the overlay's contents
take up the entire screen.

If ace is to be used in very small frames then implementors will need to
provide styling information in css to control how the settings menu
looks.
2013-04-13 20:49:46 +04:00
Matthew Kastor
24a00578c6 removed unnecessary function
since I've moved the functions to the editor and session objects
themselves I can get rid of this.
2013-04-13 20:49:46 +04:00
Matthew Kastor
b0c08dced1 adds setWrapLimit to session 2013-04-13 20:49:45 +04:00
Matthew Kastor
340f004fd0 adds getFontSize to editor 2013-04-13 20:49:45 +04:00
Matthew Kastor
1518a460ae adds description to kb & settings menu methods 2013-04-13 20:49:45 +04:00
Matthew Kastor
f6d1c1167c adds show kb & settings menu to editor 2013-04-13 20:49:45 +04:00
Matthew Kastor
c9f0439cf3 add license block 2013-04-13 20:48:57 +04:00
Matthew Kastor
c695db475a set wrap limit wraps within 20 chars 2013-04-13 20:48:57 +04:00
Matthew Kastor
6b1e90fbc7 fixed position to avoid scrolling away
The overlay menu should remain visible when scrolling a long page.  The
intention is to present information on demand and not leave the menu on
screen. If allowed to scroll away the remaining element could interfere
with the page.
2013-04-13 20:48:57 +04:00
Matthew Kastor
cc4d524a8a prettified settings menu 2013-04-13 20:47:21 +04:00
Matthew Kastor
52a1dffa9f menus will open only 1 at a time per menu. 2013-04-13 20:47:21 +04:00
Matthew Kastor
4ec0a6e706 prettified kb menu 2013-04-13 20:46:24 +04:00
Matthew Kastor
3bca16ac73 fix top margin on kb shortcuts menu 2013-04-13 20:46:24 +04:00
Matthew Kastor
fb7152cb10 prettified generic menu 2013-04-13 20:46:24 +04:00
Matthew Kastor
baaf4dd0b4 Separated logic from presentation, lowercased file names
I pulled the code for generating the menu out into its own module called
overlay_page. I pulled the code for generating a menu, using
overlay_page, out into its own module called show_keyboard_shortcuts.
The logic for getting a list of keyboard shortcuts pertinent to the
current operating system is by itself in the module
get_editor_keyboard_shortcuts. This should make it easy for anyone to
change the appearance of the menu without worrying about breaking the
code which fetches the data.
2013-04-13 20:42:55 +04:00
Matthew Kastor
d4f4758b17 adds keyboard shortcuts menu
I'm not set on the keybinding or the aesthetics of this. please change
them at will. The main goal here is to provide some method to list all
the keyboard shortcuts dynamically. I mean that when new shortcuts are
added they should automatically be put into this menu without anyone
writing any extra code. The menu provides a way for end users to easily
discover the many built in functions accessible through the keyboard.

Admittedly the current keybinding to display this menu is not very
convenient or easily guessed. I like the way that the textarea version
of ace presents a single clickable corner that is easily identified by
users. It would be cool to make this pretty and obvious.
2013-04-13 20:42:08 +04:00
Matthew Kastor
cd2bef9754 clarified comment on createNewEntry 2013-04-13 20:40:06 +04:00
Matthew Kastor
2ea0faf97b fixed typo in comment 2013-04-13 20:40:06 +04:00
Matthew Kastor
1d631b5ca1 Separated logic & presentation, lowercased file names
I lowercased the file names. I've separated the code to generate an
overlay menu out into a module called overlay_page, it is the same code
as is in my other pull request for the keyboard shortcuts menu. It
should be easy enough to change the way it looks and behaves without
worrying about breaking anything. I've pulled code out into a module
called element_generator because it is pretty generic and isn't
concerned with gathering data for the settings menu. The element
generator can be reused and augmented but there is the possibility that
modules depending on it could break. show_settings_menu depends on the
element_generator. As it collects data it generates generic elements and
attaches event listeners to them.  The massive list of options has been
moved into its own module for two reasons (1) it makes maintaining
show_settings_menu much easier and (2) this is the only part of the menu
which has to be updated manually. We may be able to add something to the
build system to automatically generate this module based on which modes
and themes are found to alleviate us from having to remember to add said
options in when new themes and modes are added.
2013-04-13 20:40:06 +04:00
Matthew Kastor
09266196ab adds settings menu to ace
I'm not stuck on the keybinding or aesthetics of this, please change
them at will. All I really want is the ability to display a menu where I
can change the editor's settings from and I want the menu to be smart
enough to automatically know about new settings. This pretty much works
except there isn't a registry for themes and modes so every new theme or
mode has to be added to the internal list by hand...
2013-04-13 20:40:06 +04:00
nightwing
3c46895f8c cleanup 2013-04-13 20:37:47 +04:00
Matthew Kastor
d0d3ca2de8 kitchen sink using statusbar extension
I refactored the kitchen sink to use the statusbar extension, deleted
the build directory, did a full rebuild and it works. :D
2013-04-13 19:50:04 +04:00
Matthew Kastor
2b362a2fa1 changed demo title 2013-04-13 19:50:04 +04:00
Matthew Kastor
43250dd064 adds statusbar demo 2013-04-13 19:50:04 +04:00
Matthew Kastor
603e4d52c0 adds inline style "display: inline-block;" 2013-04-13 19:50:04 +04:00
Matthew Kastor
640c72f44a adds statusbar to extensions
the only thing changed is the statusbar's inline styling has been
removed.
2013-04-13 19:50:04 +04:00
nightwing
8a75cdca13 cleanup 2013-04-13 19:42:14 +04:00
nightwing
978d32eca3 Create client-noconflict.html
Is this the right way to use the static highlighter with the 
noconflict build?

Edit as necessary. This is about as good as I can get it...

loads modules from script tags

makes div visible after highlighting

fixes display (sort of)

codeEl margin & padding 0

editor overflow auto, gutter position relative

replace code element with div

mode can be specified as a string

mode and theme may be specified as strings

This preserves the behavior of this method when specifying mode and
theme as objects. It adds the ability to specify mode and theme as
module paths. When specifying mode and / or theme as a module path you
must provide a callback function. The callback function will receive the
same value as the return value previously returned when specifying mode
and theme as objects.

Good stuff.

multiple elements with different modes and themes

The example shows multiple elements highlighted with different modes and
themes all in the same page. The pre element isn't ideal.

The example shows how to transfer the computed width and height of the
element into its inline style so that it won't dramatically change shape
and disrupt the page once it's had highlighting applied. It would
probably be better to replace the elements entirely and apply sizing
styles to the replacement elements but that isn't always an option.
2013-04-13 19:41:53 +04:00
nightwing
859d5c8cd9 Merge pull request #1365 from wcandillon/master
Add JSONiq mode
2013-04-13 18:11:41 +04:00
William Candillon
e099044630 Add JSONiq mode. 2013-04-13 18:10:01 +04:00