Skip to content

Commit c5fdeaf

Browse files
committed
Merge branch 'master' of https://github.com/mozilla/brackets into issue-368-mozilla#2
2 parents 72fb284 + 5c3ee26 commit c5fdeaf

39 files changed

+752
-467
lines changed

CONTRIBUTING.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,3 @@ code contributions, reviewing pull requests, and providing feedback and suggesti
121121
direction of the project.
122122

123123
Even if you're not a committer, you're still welcome to give feedback on any pull request!
124-
125-
## Adding New Files
126-
127-
When run in production (i.e., the resulting `dist/` dir from running `grunt build-browser-compressed`),
128-
Bramble uses a Service Worker to cache and serve the app offline. In order to do this, the
129-
`swPrecache` grunt task generates a Service Worker ready to cache and serve all the necessary
130-
files. This file list is generated statically at build time based on the contents of the
131-
`sw-cache-file-list.json` file. If you add new files (e.g., a new default extension), make sure
132-
you add URL entries to this cache list.

Gruntfile.js

Lines changed: 87 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ module.exports = function (grunt) {
4949
grunt.loadTasks('tasks');
5050

5151
// Project configuration.
52-
grunt.initConfig({
52+
var config = {
5353
pkg : grunt.file.readJSON("package.json"),
5454
clean: {
5555
dist: {
@@ -71,33 +71,10 @@ module.exports = function (grunt) {
7171
dist: {
7272
files: [{
7373
expand: true,
74-
cwd: 'src/',
75-
src: [
76-
/* static files */
77-
'xorigin.js',
78-
'dependencies.js',
79-
80-
/* extensions and CodeMirror modes */
81-
'!extensions/default/*/unittests.js',
82-
'extensions/default/*/**/*.js',
83-
'!extensions/extra/*/unittests.js',
84-
'extensions/extra/*/**/*.js',
85-
'!extensions/**/node_modules/**/*.js',
86-
'!extensions/**/test/**/*.js',
87-
'!**/unittest-files/**',
88-
'thirdparty/i18n/*.js',
89-
'thirdparty/text/*.js'
90-
],
74+
cwd: 'dist/',
75+
src: '**/*.js',
9176
dest: 'dist/'
9277
}]
93-
},
94-
nls: {
95-
files: [{
96-
expand: true,
97-
cwd: 'dist/nls',
98-
src: [ '**/*.js' ],
99-
dest: 'dist/nls'
100-
}]
10178
}
10279
},
10380
copy: {
@@ -128,37 +105,23 @@ module.exports = function (grunt) {
128105
dest: 'dist/',
129106
cwd: 'src/',
130107
src: [
131-
'extensions/default/**/*',
132-
'extensions/extra/**/*',
133108
'!extensibility/node/spec/**',
134109
'!extensibility/node/node_modules/**/{test,tst}/**/*',
135110
'!extensibility/node/node_modules/**/examples/**/*',
136111
'!filesystem/impls/appshell/**/*',
137-
'!extensions/default/*/unittest-files/**/*',
138-
'!extensions/default/*/unittests.js',
139-
'!extensions/default/{*/thirdparty,**/node_modules}/**/test/**/*',
140-
'!extensions/default/{*/thirdparty,**/node_modules}/**/doc/**/*',
141-
'!extensions/default/{*/thirdparty,**/node_modules}/**/examples/**/*',
142-
'!extensions/default/*/thirdparty/**/*.htm{,l}',
143-
'!extensions/extra/*/unittest-files/**/*',
144-
'!extensions/extra/*/unittests.js',
145-
'!extensions/extra/{*/thirdparty,**/node_modules}/**/test/**/*',
146-
'!extensions/extra/{*/thirdparty,**/node_modules}/**/doc/**/*',
147-
'!extensions/extra/{*/thirdparty,**/node_modules}/**/examples/**/*',
148-
'!extensions/extra/*/thirdparty/**/*.htm{,l}',
149-
'!extensions/dev/*',
150-
'!extensions/samples/**/*',
112+
// We deal with extensions dynamically below in build-extensions
113+
'!extensions/**/*',
151114
'thirdparty/CodeMirror/lib/codemirror.css',
152115
'thirdparty/i18n/*.js',
153116
'thirdparty/text/*.js'
154117
]
155118
},
156-
/* styles, fonts and images */
119+
/* styles, fonts and images - XXXBramble: we skip the fonts */
157120
{
158121
expand: true,
159122
dest: 'dist/styles',
160123
cwd: 'src/styles',
161-
src: ['jsTreeTheme.css', 'fonts/{,*/}*.*', 'images/*', 'brackets.min.css*', 'bramble_overrides.css']
124+
src: ['jsTreeTheme.css', 'images/**/*', 'brackets.min.css*', 'bramble_overrides.css']
162125
}
163126
]
164127
},
@@ -418,6 +381,16 @@ module.exports = function (grunt) {
418381
cwd: 'dist/',
419382
src: ['**/*'],
420383
dest: 'dist/'
384+
},
385+
// We need to compress the bramble-sw.js service worker file after compressing dist/
386+
sw: {
387+
options: {
388+
mode: "gzip"
389+
},
390+
expand: true,
391+
cwd: 'dist/',
392+
src: 'bramble-sw.js',
393+
dest: 'dist'
421394
}
422395
},
423396

@@ -432,19 +405,80 @@ module.exports = function (grunt) {
432405
rootDir: 'dist'
433406
}
434407
}
435-
});
408+
};
409+
410+
// Dynamically add requirejs and copy configs for all extensions
411+
function configureExtensions(config) {
412+
var extensions = grunt.file.readJSON("src/extensions/bramble-extensions.json");
413+
414+
// Write a requirejs config for each included extension
415+
extensions.forEach(function(extension) {
416+
config.requirejs[extension.path] = {
417+
options: {
418+
name: 'main',
419+
baseUrl: 'src/' + extension.path,
420+
paths: {
421+
'text' : '../../../thirdparty/text/text',
422+
'i18n' : '../../../thirdparty/i18n/i18n'
423+
},
424+
optimize: 'uglify2',
425+
preserveLicenseComments: false,
426+
useStrict: true,
427+
uglify2: {},
428+
out: 'dist/' + extension.path + '/main.js'
429+
}
430+
};
431+
});
432+
433+
// Also copy each extension's files across to dist/
434+
var extensionGlobs = [];
435+
extensions.forEach(function(extension) {
436+
// First, copy the dir itself. The main.js will get built below.
437+
extensionGlobs.push(extension.path.replace(/\/?$/, "/"));
438+
439+
// If there are any globs defined for extra paths to copy, add those too.
440+
if(extension.copy) {
441+
extensionGlobs = extensionGlobs.concat(extension.copy);
442+
}
443+
});
444+
445+
config.copy.dist.files.push({
446+
expand: true,
447+
dest: 'dist/',
448+
cwd: 'src/',
449+
src: extensionGlobs
450+
});
451+
452+
// Add a task for building all requirejs bundles for each extension
453+
var tasks = extensions.map(function(extension) {
454+
return 'requirejs:' + extension.path;
455+
});
456+
grunt.registerTask('build-extensions', tasks);
457+
458+
return config;
459+
}
460+
461+
grunt.initConfig(configureExtensions(config));
436462

437463
grunt.registerMultiTask('swPrecache', function() {
438464
var done = this.async();
439465
var rootDir = this.data.rootDir;
440-
var files = (function() {
441-
return (require('./sw-cache-file-list.json')).files;
442-
}());
443466

444467
var config = {
445468
cacheId: 'bramble',
446469
logger: grunt.log.writeln,
447-
staticFileGlobs: files,
470+
staticFileGlobs: [
471+
// Avoid caching dist/nls/**/*, but take everything else in dist/
472+
'dist/{extensions,styles,thirdparty}/**/*',
473+
'dist/*.*'
474+
],
475+
runtimeCaching: [{
476+
urlPattern: /^https:\/\/fonts\.googleapis\.com\/css/,
477+
handler: 'fastest'
478+
}, {
479+
urlPattern: /\/dist\/nls\//,
480+
handler: 'fastest'
481+
}],
448482
stripPrefix: 'dist/',
449483
ignoreUrlParametersMatching: [/./]
450484
};
@@ -496,14 +530,16 @@ module.exports = function (grunt) {
496530
'build',
497531
'requirejs:iframe',
498532
'exec:localize-dist',
533+
'build-extensions',
499534
'uglify'
500535
]);
501536

502537
// task: build dist/ for browser, pre-compressed with gzip and SW precache
503538
grunt.registerTask('build-browser-compressed', [
504539
'build-browser',
505-
'compress',
506-
'swPrecache'
540+
'compress:dist',
541+
'swPrecache',
542+
'compress:sw'
507543
]);
508544

509545
// task: undo changes to the src/nls directory

README.md

Lines changed: 14 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -72,53 +72,12 @@ should host Bramble's iframe, see `src/hosted.js`.
7272

7373
**NOTE 3:** To use Bramble in a production setting locally, you can run `npm run production` and access Bramble at [http://localhost:8000/dist](http://localhost:8000/dist)
7474

75-
# Optional Extension Loading
76-
77-
Bramble supports enabling and disabling various extensions via the URL and query params.
78-
A standard set of default extensions are always turned on:
79-
80-
* CSSCodeHints
81-
* HTMLCodeHints
82-
* JavaScriptCodeHints
83-
* InlineColorEditor
84-
* JavaScriptQuickEdit
85-
* QuickOpenCSS
86-
* QuickOpenHTML
87-
* QuickOpenJavaScript
88-
* QuickView
89-
* UrlCodeHints
90-
* brackets-paste-and-indent
91-
* BrambleUrlCodeHints
92-
* Autosave
93-
* UploadFiles
94-
* WebPlatformDocs
95-
* CodeFolding
96-
* bramble-move-file
97-
98-
You could disable QuickView and CSSCodeHints by loading Bramble with `?disableExtensions=QuickView,CSSCodeHints`
99-
on the URL.
100-
101-
In addition, you can enable other extra extensions:
102-
103-
* SVGCodeHints
104-
* HtmlEntityCodeHints
105-
* LESSSupport
106-
* CloseOthers
107-
* InlineTimingFunctionEditor
108-
* JSLint
109-
* QuickOpenCSS
110-
* RecentProjects
111-
* brackets-cdn-suggestions
112-
* HTMLHinter
113-
* MdnDocs
114-
* SVGasXML
115-
116-
You could enable JSLint and LESSSupport by loading Bramble with `?enableExtensions=JSLint,LESSSupport`
117-
on the URL
118-
119-
NOTE: you can combine `disableExtensions` and `enableExtensions` to mix loading/disabling extensions.
120-
You should check src/utils/BrambleExtensionLoader.js for the most up-to-date version of these
121-
extension lists.
75+
# Extension Loading
76+
77+
Bramble loads a set of extensions defined in `src/extensions/bramble-extensions.json`. You can
78+
alter which extensions Bramble loads by adding or removing items from this list. You can also
79+
temporarily disable extensions by using `?disableExtensions`. For example: to disable QuickView
80+
and CSSCodeHints, load Bramble with `?disableExtensions=QuickView,CSSCodeHints` on the URL.
12281

12382
--------------
12483

@@ -128,7 +87,7 @@ After you have everything setup, you can now run the server you chose in the roo
12887

12988
# Bramble IFrame API
13089

131-
Bramble is desinged to be run in an iframe, and the hosting web app to communicate with it
90+
Bramble is designed to be run in an iframe, and the hosting web app to communicate with it
13291
via `postMessage` and `MessageChannel`. In order to simplify this, a convenience API exists
13392
for creating and managing the iframe, as well as providing JavaScript functions for interacting
13493
with the editor, preview, etc.
@@ -310,6 +269,8 @@ a number of read-only getters are available in order to access state information
310269
* `getTheme()` - returns the name of the current theme.
311270
* `getFontSize()` - returns the current font size as a string (e.g., `"12px"`).
312271
* `getWordWrap()` - returns the current word wrap setting as a `Boolean` (i.e., enabled or disabled).
272+
* `getAllowJavaScript()` - returns the current allow javascript setting as a `Boolean` (i.e., enabled or disabled).
273+
* `getAutocomplete()` - returns the current autocomplete settings as a `Boolean` (i.e., enabled or disabled).
313274
* `getAutoCloseTags()` - returns the current close tags setting as an `Object` with three properties: `whenOpening` a boolean that determines whether opening tags are closed upon typing ">", `whenClosing` a boolean that determines whether closing tags are closed upon typing "/", and an array of tags `indentTags`, that when opened, has a blank line. These values default to, respectively: `true`, `true`, and an empty array.
314275
* `getTutorialExists()` - returns `true` or `false` depending on whether or not there is a tutorial in the project (i.e., if `tutorial.html` is present)
315276
* `getTutorialVisible()` - returns `true` or `false` depending on whether or not the preview browser is showing a tutorial or not.
@@ -327,7 +288,7 @@ to be notified when the action completes:
327288
* `undo([callback])` - undo the last operation in the editor (waits for focus)
328289
* `redo([callback])` - redo the last operation that was undone in the editor (waits for focus)
329290
* `increaseFontSize([callback])` - increases the editor's font size
330-
* `decreaseFontSize([callback])` - decreases the edtior's font size
291+
* `decreaseFontSize([callback])` - decreases the editor's font size
331292
* `restoreFontSize([callback])` - restores the editor's font size to normal
332293
* `save([callback])` - saves the current document
333294
* `saveAll([callback])` - saves all "dirty" documents
@@ -347,7 +308,7 @@ to be notified when the action completes:
347308
* `useMobilePreview([callback])` - uses a Mobile view in the preview, as it would look on a smartphone
348309
* `useDesktopPreview([callback])` - uses a Desktop view in the preview, as it would look on a desktop computer (default)
349310
* `enableFullscreenPreview([callback])` - shows a fullscreen preview of the current file
350-
* `disableFullscreenPreview([callback])` - turns off the fullscreen preview of the curent file
311+
* `disableFullscreenPreview([callback])` - turns off the fullscreen preview of the current file
351312
* `enableAutoUpdate([callback])` - turns on auto-update for the preview (default)
352313
* `disableAutoUpdate([callback])` - turns off auto-update for the preview (manual reloads still work)
353314
* `enableJavaScript([callback])` - turns on JavaScript execution for the preview (default)
@@ -370,13 +331,14 @@ to be notified when the action completes:
370331
The Bramble instance is also an [`EventEmitter`](https://github.com/Wolfy87/EventEmitter/) and raises
371332
the following events:
372333

373-
* `"layout"` - triggered whenever the sidebar, editor, or preview panes are changed. It includes an `Object` that returns the same infor as the `getLayout()` getter: : `sidebarWidth`, `firstPaneWidth`, `secondPathWidth`
334+
* `"layout"` - triggered whenever the sidebar, editor, or preview panes are changed. It includes an `Object` that returns the same information as the `getLayout()` getter: : `sidebarWidth`, `firstPaneWidth`, `secondPathWidth`
374335
* `"activeEditorChange"` - triggered whenever the editor changes from one file to another. It includes an `Object` with the current file's `fullPath` and `filename`.
375336
* `"previewModeChange"` - triggered whenever the preview mode is changed. It includes an `Object` with the new `mode`
376337
* `"sidebarChange"` - triggered whenever the sidebar is hidden or shown. It includes an `Object` with a `visible` property set to `true` or `false`
377-
* `"themeChange"` - triggered whenever the theme changes. It inclues an `Object` with a `theme` property that indicates the new theme
338+
* `"themeChange"` - triggered whenever the theme changes. It includes an `Object` with a `theme` property that indicates the new theme
378339
* `"fontSizeChange"` - triggered whenever the font size changes. It includes an `Object` with a `fontSize` property that indicates the new size (e.g., `"12px"`).
379340
* `"wordWrapChange"` - triggered whenever the word wrap value changes. It includes an `Object` with a `wordWrap` property that indicates the new value (e.g., `true` or `false`).
341+
* `"allowJavaScriptChange"` - triggered whenever the allow javascript value changes. It includes an `Object` with a `allowJavaScript` property that indicates the new value (e.g., `true` or `false`).
380342
* `"autoCloseTagsChange"` - triggered whenever the close tag value changes. It includes an `Object` with a `autoCloseTags` property that indicates the new value
381343
* `"tutorialAdded"` - triggered when a new tutorial is added to the project
382344
* `"tutorialRemoved"` - triggered when an existing tutorial for the project is removed

locales/el/editor.properties

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,11 @@ ERROR_MAX_FILES_TITLE=Σφάλμα ευρετηριοποίησης αρχείω
5555

5656
EXT_MODIFIED_TITLE=Εξωτερικές αλλαγές
5757
# {0} will be replaced by a filename and {APP_NAME} will be replaced with the word "Brackets"
58+
EXT_MODIFIED_WARNING=Το <span class='dialog-filename'>{0}</span> έχει τροποποιηθεί στο δίσκο εκτός των {APP_NAME}.<br /><br />Θέλετε να αποθηκεύσετε το αρχείο και να αντικαταστήσετε αυτές τις αλλαγές;
5859
# {0} will be replaced by a filename and {APP_NAME} will be replaced with the word "Brackets"
60+
EXT_MODIFIED_MESSAGE=Το <span class='dialog-filename'>{0}</span> έχει τροποποιηθεί στο δίσκο εκτός των {APP_NAME}, αλλά έχει και μη αποθηκευμένες αλλαγές στο {APP_NAME}.<br /><br />Ποια έκδοση θέλετε να κρατήσετε;
5961
# {0} will be replaced by a filename and {APP_NAME} will be replaced with the word "Brackets"
62+
EXT_DELETED_MESSAGE=Το <span class='dialog-filename'>{0}</span> έχει διαγραφεί στο δίσκο εκτός των {APP_NAME}, αλλά έχει και μη αποθηκευμένες αλλαγές στο {APP_NAME}.<br /><br />Θέλετε να διατηρήσετε τις αλλαγές σας;
6063

6164

6265
#############
@@ -83,6 +86,10 @@ BUTTON_NO=Όχι
8386
# Quick Edit
8487

8588
ERROR_QUICK_EDIT_PROVIDER_NOT_FOUND=Η Γρήγορη Επεξεργασία δεν είναι διαθέσιμη για την τρέχουσα θέση του κέρσορα
89+
ERROR_CSSQUICKEDIT_BETWEENCLASSES=Γρήγορη επεξεργασία CSS: τοποθετήστε τον κέρσορα σε ένα μόνο όνομα κατηγορίας
90+
ERROR_CSSQUICKEDIT_CLASSNOTFOUND=Γρήγορη επεξεργασία CSS: μη πλήρης ιδιότητα κατηγορίας
91+
ERROR_CSSQUICKEDIT_IDNOTFOUND=Γρήγορη επεξεργασία CSS: μη πλήρης ιδιότητα id
92+
ERROR_CSSQUICKEDIT_UNSUPPORTEDATTR=Γρήγορη επεξεργασία CSS: τοποθετήστε τον κέρσορα στην ετικέτα, την κατηγορία ή το id
8693
BUTTON_NEW_RULE=Νέος κανόνας
8794

8895
# Quick Docs
@@ -103,6 +110,7 @@ CMD_TOGGLE_QUICK_DOCS=Γρήγορα έγγραφα
103110

104111
# Drag and Drop
105112

113+
DND_MAX_FILE_SIZE_EXCEEDED=το αρχείο ξεπερνά το μέγιστο υποστηριζόμενο μέγεθος: 3MB
106114
DND_UNSUPPORTED_FILE_TYPE=μη υποστηριζόμενος τύπος αρχείου
107115
DND_ERROR_UNZIP=αδυναμία αποσυμπίεσης αρχείου
108116
DND_ERROR_UNTAR=αδυναμία αποσυμπίεσης αρχείου .tar
@@ -163,4 +171,5 @@ PROJECT_ROOT=Ρίζα έργου
163171
PICK_A_FOLDER_TO_MOVE_TO=Επιλογή φακέλου
164172
ERROR_MOVING_FILE_DIALOG_HEADER=Σφάλμα μετακίνησης
165173
# {0} is the name of the file/folder being moved and {1} is the name of the folder it is being moved to
174+
UNEXPECTED_ERROR_MOVING_FILE=Προέκυψε απρόσμενο σφάλμα κατά την προσπάθεια μετακίνησης του {0} στο φάκελο "{1}"
166175
# {0} is the name of the file/folder being moved and {1} is the name of the folder it is being moved to

locales/en-US/editor.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ DND_SUCCESS_UNZIP=Successfully unzipped <b>{0}</b>.
136136
# {0} will be replaced by a tar filename
137137
DND_SUCCESS_UNTAR=Successfully untarred <b>{0}</b>.
138138

139+
# Image Viewer
140+
IMAGE_DIMENSIONS={0} (width) &times; {1} (height) pixels
141+
139142
################
140143
## EXTENSIONS ##
141144
################

0 commit comments

Comments
 (0)