Skip to content

Commit

Permalink
Merge remote-tracking branch 'adobe/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
zaggino committed May 8, 2017
2 parents f5ffcb8 + c8c3add commit f3e00c0
Show file tree
Hide file tree
Showing 17 changed files with 1,010 additions and 401 deletions.
14 changes: 7 additions & 7 deletions samples/ja/Getting Started/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@ <h1>BRACKETS をはじめる前に</h1>
<h2>まずはこのガイドからスタート</h2>

<!--
MADE WITH <3 AND JAVASCRIPT
<3 とJAVASCRIPT で作成
-->

<p>
Web デザインを認識する最新のオープンソースエディター、Brackets をご利用いただき、ありがとうございます。軽量でありながらパワフルなコードエディターでのビジュアルツールとエディターとの融合により、必要なときに必要なだけのサポートを利用することができます。
</p>

<!--
WHAT IS BRACKETS?
Brackets とは何ですか
-->
<p>
<em>Brackets は、新しいタイプのエディターです。</em>
Brackets にはクイック編集やライブプレビューなど、他のエディターにはないユニークな機能が備わっています。Brackets は JavaScript、HTML および CSS で記述されています。つまり、ほとんどの Brackets ユーザーは、習得済みのスキルを使って、このエディターそのものを変更したり拡張したりできるということになります。実際、アドビ社内の開発チームも、毎日 Brackets を使用して Brackets の構築を進めています。主要機能の使用方法について、下記で詳しくご説明します。
</p>

<!--
GET STARTED WITH YOUR OWN FILES
自分のファイルで始めましょう
-->

<h3>Brackets のプロジェクト</h3>
Expand All @@ -45,7 +45,7 @@ <h3>Brackets のプロジェクト</h3>
</samp>

<!--
THE RELATIONSHIP BETWEEN HTML, CSS AND JAVASCRIPT
HTMLCSS とJavaScript との関係
-->
<h3>CSS と JavaScript のクイック編集</h3>
<p>
Expand All @@ -71,7 +71,7 @@ <h3>CSS と JavaScript のクイック編集</h3>
</p>

<!--
LIVE PREVIEW
ライブ プレビュー
-->
<h3>HTML および CSS の編集結果をブラウザーでライブプレビュー</h3>
<p>
Expand Down Expand Up @@ -114,7 +114,7 @@ <h3>拡張機能でさらに補強</h3>
</p>

<!--
LET US KNOW WHAT YOU THINK
ご意見をお聞かせください
-->
<h2>Brackets プロジェクトに参加</h2>
<p>
Expand Down Expand Up @@ -155,4 +155,4 @@ <h2>Brackets プロジェクトに参加</h2>
[:::::::::::::: ::::::::::::::]
[[[[[[[[[[[[[[[ ]]]]]]]]]]]]]]]
-->
-->
30 changes: 15 additions & 15 deletions src/LiveDevelopment/Agents/RemoteFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,17 +298,17 @@ function RemoteFunctions(config, remoteWSPort) {

var borderBox = elementStyling.boxSizing === 'border-box';

var innerWidth = parseInt(elementStyling.width),
innerHeight = parseInt(elementStyling.height),
var innerWidth = parseFloat(elementStyling.width),
innerHeight = parseFloat(elementStyling.height),
outerHeight = innerHeight,
outerWidth = innerWidth;

if (!borderBox) {
innerWidth += parseInt(elementStyling.paddingLeft) + parseInt(elementStyling.paddingRight);
innerHeight += parseInt(elementStyling.paddingTop) + parseInt(elementStyling.paddingBottom);
outerWidth = innerWidth + parseInt(realElBorder.right) +
parseInt(realElBorder.left),
outerHeight = innerHeight + parseInt(realElBorder.bottom) + parseInt(realElBorder.top);
innerWidth += parseFloat(elementStyling.paddingLeft) + parseFloat(elementStyling.paddingRight);
innerHeight += parseFloat(elementStyling.paddingTop) + parseFloat(elementStyling.paddingBottom);
outerWidth = innerWidth + parseFloat(realElBorder.right) +
parseFloat(realElBorder.left),
outerHeight = innerHeight + parseFloat(realElBorder.bottom) + parseFloat(realElBorder.top);
}


Expand All @@ -326,7 +326,7 @@ function RemoteFunctions(config, remoteWSPort) {
elStyling['top'] = 0;

if (borderBox) {
elStyling['height'] = innerHeight - parseInt(realElBorder.top) - parseInt(realElBorder.bottom) + "px";
elStyling['height'] = innerHeight - parseFloat(realElBorder.top) - parseFloat(realElBorder.bottom) + "px";
}

} else {
Expand All @@ -335,7 +335,7 @@ function RemoteFunctions(config, remoteWSPort) {
elStyling['left'] = 0;

if (borderBox) {
elStyling['width'] = innerWidth - parseInt(realElBorder.left) - parseInt(realElBorder.right) + "px";
elStyling['width'] = innerWidth - parseFloat(realElBorder.left) - parseFloat(realElBorder.right) + "px";
}
}

Expand All @@ -349,23 +349,23 @@ function RemoteFunctions(config, remoteWSPort) {
var elStyling = {};

var margin = [];
margin['right'] = parseInt(elementStyling.getPropertyValue('margin-right'));
margin['top'] = parseInt(elementStyling.getPropertyValue('margin-top'));
margin['bottom'] = parseInt(elementStyling.getPropertyValue('margin-bottom'));
margin['left'] = parseInt(elementStyling.getPropertyValue('margin-left'));
margin['right'] = parseFloat(elementStyling.getPropertyValue('margin-right'));
margin['top'] = parseFloat(elementStyling.getPropertyValue('margin-top'));
margin['bottom'] = parseFloat(elementStyling.getPropertyValue('margin-bottom'));
margin['left'] = parseFloat(elementStyling.getPropertyValue('margin-left'));

if(visualisations['horizontal'].indexOf(side) >= 0) {

elStyling['width'] = elementStyling.getPropertyValue('margin-' + side);
elStyling['height'] = outerHeight + margin['top'] + margin['bottom'] + "px";
elStyling['top'] = "-" + (margin['top'] + parseInt(realElBorder.top)) + "px";
elStyling['top'] = "-" + (margin['top'] + parseFloat(realElBorder.top)) + "px";
} else {
elStyling['height'] = elementStyling.getPropertyValue('margin-' + side);
elStyling['width'] = outerWidth + "px";
elStyling['left'] = "-" + realElBorder.left;
}

elStyling[side] = "-" + (margin[side] + parseInt(realElBorder[side])) + "px";
elStyling[side] = "-" + (margin[side] + parseFloat(realElBorder[side])) + "px";
elStyling['position'] = 'absolute';

return elStyling;
Expand Down
2 changes: 1 addition & 1 deletion src/extensibility/node/npm-installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function performNpmInstallIfRequired(npmOptions, validationResult, callback) {
packageJson = null;
}

if (!packageJson || !packageJson.dependencies) {
if (!packageJson || !packageJson.dependencies || !Object.keys(packageJson.dependencies).length) {
return finish();
}

Expand Down
10 changes: 10 additions & 0 deletions src/extensions/default/CSSAtRuleCodeHints/AtRulesDef.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"@charset": "Defines the character set used by the style sheet.",
"@import": "Tells the CSS engine to include an external style sheet.",
"@namespace": "Tells the CSS engine that all its content must be considered prefixed with an XML namespace.",
"@media": "A conditional group rule which will apply its content if the device meets the criteria of the condition defined using a media query.",
"@supports": "A conditional group rule which will apply its content if the browser meets the criteria of the given condition.",
"@page": "Describes the aspect of layout changes which will be applied when printing the document.",
"@font-face": "Describes the aspect of an external font to be downloaded.",
"@keyframes": "Describes the aspect of intermediate steps in a CSS animation sequence."
}
118 changes: 118 additions & 0 deletions src/extensions/default/CSSAtRuleCodeHints/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
/*
* Copyright (c) 2017 - present Adobe Systems Incorporated. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/

define(function (require, exports, module) {
"use strict";

// Load dependent modules
var AppInit = brackets.getModule("utils/AppInit"),
CodeHintManager = brackets.getModule("editor/CodeHintManager"),
AtRulesText = require("text!AtRulesDef.json"),
AtRules = JSON.parse(AtRulesText);


/**
* @constructor
*/
function AtRuleHints() {
}

// As we are only going to provide @rules name hints
// we should claim that we don't have hints for anything else
AtRuleHints.prototype.hasHints = function (editor, implicitChar) {
var pos = editor.getCursorPos(),
token = editor._codeMirror.getTokenAt(pos),
cmState;

this.editor = editor;

if (token.state.base && token.state.base.localState) {
cmState = token.state.base.localState;
} else {
cmState = token.state;
}

// Check if we are at '@' rule 'def' context
if ((token.type === "def" && cmState.context.type === "at")
|| (token.type === "variable-2" && (cmState.context.type === "top" || cmState.context.type === "block"))) {
this.filter = token.string;
return true;
} else {
this.filter = null;
return false;
}
};

AtRuleHints.prototype.getHints = function (implicitChar) {
var pos = this.editor.getCursorPos(),
token = this.editor._codeMirror.getTokenAt(pos);

this.filter = token.string;
this.token = token;

if (!this.filter) {
return null;
}

// Filter the property list based on the token string
var result = Object.keys(AtRules).filter(function (key) {
if (key.indexOf(token.string) === 0) {
return key;
}
}).sort();

return {
hints: result,
match: this.filter,
selectInitial: true,
defaultDescriptionWidth: true,
handleWideResults: false
};
};


/**
* Inserts a given @<rule> hint into the current editor context.
*
* @param {string} completion
* The hint to be inserted into the editor context.
*
* @return {boolean}
* Indicates whether the manager should follow hint insertion with an
* additional explicit hint request.
*/
AtRuleHints.prototype.insertHint = function (completion) {
var cursor = this.editor.getCursorPos();
this.editor.document.replaceRange(completion, {line: cursor.line, ch: this.token.start}, {line: cursor.line, ch: this.token.end});
return false;
};

AppInit.appReady(function () {
// Register code hint providers
var restrictedBlockHints = new AtRuleHints();
CodeHintManager.registerHintProvider(restrictedBlockHints, ["css", "less", "scss"], 0);

// For unit testing
exports.restrictedBlockHints = restrictedBlockHints;
});
});
Loading

0 comments on commit f3e00c0

Please sign in to comment.