Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/master' into jasonsanjose/statusbar
Browse files Browse the repository at this point in the history
Conflicts:
	src/editor/EditorManager.js
	src/widgets/StatusBar.js
  • Loading branch information
jasonsanjose committed Oct 4, 2012
2 parents c5f005e + d2cbe88 commit 6a9046b
Show file tree
Hide file tree
Showing 9 changed files with 445 additions and 10 deletions.
115 changes: 115 additions & 0 deletions samples/pt-br/Primeiros Passos/index.html
@@ -0,0 +1,115 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>PRIMEIROS PASSOS COM BRACKETS</title>
<meta name="description" content="Um guia interativo de primeiros passos para Brackets.">
<link rel="stylesheet" href="main.css">
</head>
<body>

<h1>PRIMEIROS PASSOS COM BRACKETS</h1>
<h2>Este é o seu guia!</h2>

<!--
MADE WITH <3 AND JAVASCRIPT
-->

<p>
Bem-vindo a uma superprecoce pré-visualização de Brackets, um novo editor open-source para a próxima geração da web. Nós somos grandes fãs dos padrões e queremos construir melhores ferramentas para JavaScript, HTML e CSS
e relacionadas tecnologias abertas da web. Este é o nosso humilde começo.
</p>

<!--
O QUE É BRACKETS?
-->
<p>
<em>Você está olhando para uma versão precoce de Brackets.</em>
De muitas maneiras, Brackets é um tipo diferente de editor. Uma diferença notável é que este editor é escrito em JavaScript. Assim, enquanto Brackets poderia não estar pronto para seu uso no dia-a-dia ainda, estamos usando-o todos os dias para criar Brackets.
</p>


<h2>Nós estamos tentando algumas coisas novas</h2>

<!--
A RELAÇÃO ENTRE HTML, CSS E JAVASCRIPT
-->
<h3>Edição Rápida de CSS e JavaScript</h3>
<p>
Ao editar HTML, use o atalho <kbd>Cmd/Ctrl + E</kbd> para abrir um editor rápido embutido que exibe todos os CSS relacionados. Faça um ajuste ao seu CSS, pressione <kbd>ESC</kbd> e você estará de volta editando HTML. Ou simplesmente deixe as regras CSS abertas e elas se tornarão parte de seu editor HTML.
Se você pressionar <kbd>ESC</kbd> fora de um editor rápido, todos eles vão recolher. Sem mais comutação entre documentos perdendo seu contexto.
</p>

<samp>
Quer vê-lo em ação? Coloque o cursor sobre o tag <!-- <samp> --> acima e pressione <kbd>Cmd/Ctrl + E</kbd>. Você deverá ver um editor rápido de CSS aparecer acima. À direita, você verá uma lista de regras CSS que estão relacionadas com esta tag.Simplesmente role as regras com <kbd>Alt + Up/Down</kbd> para encontrar o que deseja editar.
</samp>

<a href="screenshots/brackets-quick-edit.png">
<img alt="A screenshot showing CSS Quick Edit" src="screenshots/brackets-quick-edit.png" />
</a>

<!--
VISUALIZAÇÃO AO VIVO (LIVE PREVIEW)
-->
<h3>Visualizar as alterações CSS ao vivo no navegador</h3>
<p>
Você sabe aquela "dança salvar/recarregar" que temos feito há anos? Aquela onde você faz mudanças no seu editor, clica em salvar, alterna para o navegador e então recarrega a pagina para finalmente ver o resultado Com Brackets, você não precisa fazer essa dança.
</p>
<p>
Brackets vai abrir uma <em>conexão ao vivo</em> com o seu navegador local e vai empurrar atualizações CSS enquanto você digita! Você já deve estar fazendo alguma coisa como esta hoje com ferramentas baseadas em navegador, mas com Brackets
não há necessidade de copiar e colar o CSS final de volta para o editor. Seu código é executado no navegador, mas vive em seu editor!
</p>

<samp>
Se você tem o Google Chrome instalado, você pode tentar fazer isso sozinho. Clique no ícone em forma de raio no canto superior direito ou pressione <kbd>Cmd/Ctrl + Alt + P</kbd>. Quando a Visualização ao Vivo (Live Preview) é habilitada em um documento HTML, todos os documentos CSS vinculados podem ser editados em tempo real. O ícone vai mudar de cinza para ouro quando Brackets estabelecer uma conexão com o seu navegador.

Agora, coloque o cursor sobre o tag <!-- <img> --> acima e use <kbd>Cmd/Ctrl + E</kbd> para abrir as regras CSS definidas. Tente mudar o tamanho da borda de 1px para 10px ou alterar a cor de fundo de "dimgray" para "hotpink". Se você tem Brackets e seu navegador rodando lado a lado, você vai ver as alterações refletidas instantaneamente no seu navegador. Legal, certo?
</samp>

<p class="note">
Atualmente, Brackets suporta Visualização ao Vivo (Live Preview) apenas para CSS. Iremos adicionar suporte à Visualização ao Vivo (Live Preview) para HTML e JavaScript em uma versão futura. Visualizações ao vivo atualmente só são possíveis com Google Chrome. Nós queremos trazer esta funcionalidade para todos os principais navegadores, e estamos ansiosos para trabalhar com os fornecedores.
</p>

<!--
DEIXE-NOS CONHECER O QUE VOCÊ PENSA
-->
<h2>Envolva-se</h2>
<p>
Brackets é um projeto open-source. Desenvolvedores web de todo o mundo estão a contribuir para criar um editor de código melhor. Diga-nos o que você pensa, partilhe as suas ideias ou contribua diretamente para o projeto.
</p>
<ul>
<li><a href="http://brackets.io">Brackets.io</a></li>
<li><a href="http://blog.brackets.io">Blog da Equipe Brackets</a></li>
<li><a href="http://github.com/adobe/brackets">Brackets no GitHub</a></li>
<li><a href="http://github.com/adobe/brackets/wiki">Brackets Wiki</a></li>
<li><a href="http://groups.google.com/group/brackets-dev">Mailing List Desenvolvedores Brackets</a></li>
<li><a href="https://twitter.com/#!/brackets">@Brackets no Twitter</a></li>
<li>Fale com os desenvolvedores no canal IRC #brackets no Freenode</li>
</ul>

</body>
</html>
<!--
[[[[[[[[[[[[[[[ ]]]]]]]]]]]]]]]
[:::::::::::::: ::::::::::::::]
[:::::::::::::: ::::::::::::::]
[::::::[[[[[[[: :]]]]]]]::::::]
[:::::[ ]:::::]
[:::::[ ]:::::]
[:::::[ ]:::::]
[:::::[ ]:::::]
[:::::[ CODE THE WEB ]:::::]
[:::::[ http://brackets.io ]:::::]
[:::::[ ]:::::]
[:::::[ ]:::::]
[:::::[ ]:::::]
[:::::[ ]:::::]
[::::::[[[[[[[: :]]]]]]]::::::]
[:::::::::::::: ::::::::::::::]
[:::::::::::::: ::::::::::::::]
[[[[[[[[[[[[[[[ ]]]]]]]]]]]]]]]
-->
36 changes: 36 additions & 0 deletions samples/pt-br/Primeiros Passos/main.css
@@ -0,0 +1,36 @@
html {
background-color: #eeeeee;
}

body {
margin: 0 auto;
padding: 2em;
max-width: 800px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.5em;
color: #333333;
background-color: #ffffff;
-webkit-box-shadow: 0 0 12px rgba(0, 0, 0, 0.4);
-moz-box-shadow: 0 0 12px rgba(0, 0, 0, 0.4);
box-shadow: 0 0 12px rgba(0, 0, 0, 0.4);
}

h1, h2, h3, h4, h5, h6 {
line-height: 1.3em;
}

samp
{
/* hide <samp> from the browser so we can show cool features in Edge Code */
display: none;
}

img
{
border: 1px solid black;
background-color: dimgray;
padding: 10px;
margin: 10px 0;
max-width: 95%;
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/brackets.js
Expand Up @@ -268,6 +268,12 @@ define(function (require, exports, module) {
}
}

// Prevent unhandled mousedown events from triggering native behavior
// Example: activating AutoScroll when clicking the middle mouse button (see #510)
$("html").on("mousedown", function(event) {
event.preventDefault();
});

// Localize MainViewHTML and inject into <BODY> tag
var templateVars = $.extend({
ABOUT_ICON : brackets.config.about_icon,
Expand Down
15 changes: 15 additions & 0 deletions src/editor/Editor.js
Expand Up @@ -599,6 +599,13 @@ define(function (require, exports, module) {
// notify all inline widgets of a position change
self._fireWidgetOffsetTopChanged(self.getFirstVisibleLine() - 1);
});

// Convert CodeMirror onFocus events to EditorManager focusedEditorChanged
this._codeMirror.setOption("onFocus", function () {
if (!self._internalFocus) {
EditorManager._doFocusedEditorChanged(self);
}
});
};

/**
Expand Down Expand Up @@ -924,7 +931,15 @@ define(function (require, exports, module) {

/** Gives focus to the editor control */
Editor.prototype.focus = function () {
// Capture the currently focused editor before making CodeMirror changes
var previous = EditorManager.getFocusedEditor();

// Prevent duplicate focusedEditorChanged events with this _internalFocus flag
this._internalFocus = true;
this._codeMirror.focus();
this._internalFocus = false;

EditorManager._doFocusedEditorChanged(this, previous);
};

/** Returns true if the editor has focus */
Expand Down
19 changes: 10 additions & 9 deletions src/editor/EditorManager.js
Expand Up @@ -35,7 +35,8 @@
* must have some knowledge about Document's internal state (we access its _editor property).
*
* This module dispatches the following events:
* - focusedEditorChange -- Fires asynchronously after the focused editor (full or inline) changes and size/visibility are complete.
* - focusedEditorChange -- Fires asynchronously after the focused editor
* (full or inline) changes and size/visibility are complete.
*/
define(function (require, exports, module) {
"use strict";
Expand Down Expand Up @@ -356,8 +357,9 @@ define(function (require, exports, module) {
_currentEditor.setVisible(false);
}

// current may be an inline editor, but _currentEditor must be a full editor
if (current && !current._visibleRange) {
// _currentEditor must be a full editor or null (show no editor).
// _currentEditor must not be an inline editor
if (!current || (current && !current._visibleRange)) {
_currentEditor = current;
}

Expand All @@ -377,7 +379,7 @@ define(function (require, exports, module) {
function _doShow(document) {
// Show new editor
_currentEditorsDocument = document;
_doFocusedEditorChanged(document._masterEditor);
_doFocusedEditorChanged(document._masterEditor, _currentEditor);
}

/**
Expand Down Expand Up @@ -408,8 +410,7 @@ define(function (require, exports, module) {
function _showNoEditor() {
if (_currentEditor) {
_destroyEditorIfUnneeded(_currentEditorsDocument);
_doFocusedEditorChanged(null);

_doFocusedEditorChanged(null, _currentEditor);
_currentEditorsDocument = null;

$("#not-editor").css("display", "");
Expand Down Expand Up @@ -678,19 +679,19 @@ define(function (require, exports, module) {
$indentIncrement.on("click", function () { _updateIndentSize(1); });

StatusBar.hide();
_onFocusedEditorChange();
_onFocusedEditorChange(null, getFocusedEditor(), null);
});

// For unit tests and internal use only
exports._openInlineWidget = _openInlineWidget;
exports._doFocusedEditorChanged = _doFocusedEditorChanged;
exports._createFullEditorForDocument = _createFullEditorForDocument;
exports._destroyEditorIfUnneeded = _destroyEditorIfUnneeded;

// Define public API
exports.setEditorHolder = setEditorHolder;
exports.getCurrentFullEditor = getCurrentFullEditor;
exports.createInlineEditorForDocument = createInlineEditorForDocument;
exports._createFullEditorForDocument = _createFullEditorForDocument;
exports._destroyEditorIfUnneeded = _destroyEditorIfUnneeded;
exports.focusEditor = focusEditor;
exports.getFocusedEditor = getFocusedEditor;
exports.getFocusedInlineWidget = getFocusedInlineWidget;
Expand Down

0 comments on commit 6a9046b

Please sign in to comment.