Skip to content

Commit f3e00c0

Browse files
committed
Merge remote-tracking branch 'adobe/master'
2 parents f5ffcb8 + c8c3add commit f3e00c0

File tree

17 files changed

+1010
-401
lines changed

17 files changed

+1010
-401
lines changed

samples/ja/Getting Started/index.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@ <h1>BRACKETS をはじめる前に</h1>
1414
<h2>まずはこのガイドからスタート</h2>
1515

1616
<!--
17-
MADE WITH <3 AND JAVASCRIPT
17+
<3 とJAVASCRIPT で作成
1818
-->
1919

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

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

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

3636
<h3>Brackets のプロジェクト</h3>
@@ -45,7 +45,7 @@ <h3>Brackets のプロジェクト</h3>
4545
</samp>
4646

4747
<!--
48-
THE RELATIONSHIP BETWEEN HTML, CSS AND JAVASCRIPT
48+
HTMLCSS とJavaScript との関係
4949
-->
5050
<h3>CSS と JavaScript のクイック編集</h3>
5151
<p>
@@ -71,7 +71,7 @@ <h3>CSS と JavaScript のクイック編集</h3>
7171
</p>
7272

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

116116
<!--
117-
LET US KNOW WHAT YOU THINK
117+
ご意見をお聞かせください
118118
-->
119119
<h2>Brackets プロジェクトに参加</h2>
120120
<p>
@@ -155,4 +155,4 @@ <h2>Brackets プロジェクトに参加</h2>
155155
[:::::::::::::: ::::::::::::::]
156156
[[[[[[[[[[[[[[[ ]]]]]]]]]]]]]]]
157157
158-
-->
158+
-->

src/LiveDevelopment/Agents/RemoteFunctions.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -298,17 +298,17 @@ function RemoteFunctions(config, remoteWSPort) {
298298

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

301-
var innerWidth = parseInt(elementStyling.width),
302-
innerHeight = parseInt(elementStyling.height),
301+
var innerWidth = parseFloat(elementStyling.width),
302+
innerHeight = parseFloat(elementStyling.height),
303303
outerHeight = innerHeight,
304304
outerWidth = innerWidth;
305305

306306
if (!borderBox) {
307-
innerWidth += parseInt(elementStyling.paddingLeft) + parseInt(elementStyling.paddingRight);
308-
innerHeight += parseInt(elementStyling.paddingTop) + parseInt(elementStyling.paddingBottom);
309-
outerWidth = innerWidth + parseInt(realElBorder.right) +
310-
parseInt(realElBorder.left),
311-
outerHeight = innerHeight + parseInt(realElBorder.bottom) + parseInt(realElBorder.top);
307+
innerWidth += parseFloat(elementStyling.paddingLeft) + parseFloat(elementStyling.paddingRight);
308+
innerHeight += parseFloat(elementStyling.paddingTop) + parseFloat(elementStyling.paddingBottom);
309+
outerWidth = innerWidth + parseFloat(realElBorder.right) +
310+
parseFloat(realElBorder.left),
311+
outerHeight = innerHeight + parseFloat(realElBorder.bottom) + parseFloat(realElBorder.top);
312312
}
313313

314314

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

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

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

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

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

351351
var margin = [];
352-
margin['right'] = parseInt(elementStyling.getPropertyValue('margin-right'));
353-
margin['top'] = parseInt(elementStyling.getPropertyValue('margin-top'));
354-
margin['bottom'] = parseInt(elementStyling.getPropertyValue('margin-bottom'));
355-
margin['left'] = parseInt(elementStyling.getPropertyValue('margin-left'));
352+
margin['right'] = parseFloat(elementStyling.getPropertyValue('margin-right'));
353+
margin['top'] = parseFloat(elementStyling.getPropertyValue('margin-top'));
354+
margin['bottom'] = parseFloat(elementStyling.getPropertyValue('margin-bottom'));
355+
margin['left'] = parseFloat(elementStyling.getPropertyValue('margin-left'));
356356

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

359359
elStyling['width'] = elementStyling.getPropertyValue('margin-' + side);
360360
elStyling['height'] = outerHeight + margin['top'] + margin['bottom'] + "px";
361-
elStyling['top'] = "-" + (margin['top'] + parseInt(realElBorder.top)) + "px";
361+
elStyling['top'] = "-" + (margin['top'] + parseFloat(realElBorder.top)) + "px";
362362
} else {
363363
elStyling['height'] = elementStyling.getPropertyValue('margin-' + side);
364364
elStyling['width'] = outerWidth + "px";
365365
elStyling['left'] = "-" + realElBorder.left;
366366
}
367367

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

371371
return elStyling;

src/extensibility/node/npm-installer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function performNpmInstallIfRequired(npmOptions, validationResult, callback) {
114114
packageJson = null;
115115
}
116116

117-
if (!packageJson || !packageJson.dependencies) {
117+
if (!packageJson || !packageJson.dependencies || !Object.keys(packageJson.dependencies).length) {
118118
return finish();
119119
}
120120

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"@charset": "Defines the character set used by the style sheet.",
3+
"@import": "Tells the CSS engine to include an external style sheet.",
4+
"@namespace": "Tells the CSS engine that all its content must be considered prefixed with an XML namespace.",
5+
"@media": "A conditional group rule which will apply its content if the device meets the criteria of the condition defined using a media query.",
6+
"@supports": "A conditional group rule which will apply its content if the browser meets the criteria of the given condition.",
7+
"@page": "Describes the aspect of layout changes which will be applied when printing the document.",
8+
"@font-face": "Describes the aspect of an external font to be downloaded.",
9+
"@keyframes": "Describes the aspect of intermediate steps in a CSS animation sequence."
10+
}
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
/*
2+
* Copyright (c) 2017 - present Adobe Systems Incorporated. All rights reserved.
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a
5+
* copy of this software and associated documentation files (the "Software"),
6+
* to deal in the Software without restriction, including without limitation
7+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+
* and/or sell copies of the Software, and to permit persons to whom the
9+
* Software is furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20+
* DEALINGS IN THE SOFTWARE.
21+
*
22+
*/
23+
24+
define(function (require, exports, module) {
25+
"use strict";
26+
27+
// Load dependent modules
28+
var AppInit = brackets.getModule("utils/AppInit"),
29+
CodeHintManager = brackets.getModule("editor/CodeHintManager"),
30+
AtRulesText = require("text!AtRulesDef.json"),
31+
AtRules = JSON.parse(AtRulesText);
32+
33+
34+
/**
35+
* @constructor
36+
*/
37+
function AtRuleHints() {
38+
}
39+
40+
// As we are only going to provide @rules name hints
41+
// we should claim that we don't have hints for anything else
42+
AtRuleHints.prototype.hasHints = function (editor, implicitChar) {
43+
var pos = editor.getCursorPos(),
44+
token = editor._codeMirror.getTokenAt(pos),
45+
cmState;
46+
47+
this.editor = editor;
48+
49+
if (token.state.base && token.state.base.localState) {
50+
cmState = token.state.base.localState;
51+
} else {
52+
cmState = token.state;
53+
}
54+
55+
// Check if we are at '@' rule 'def' context
56+
if ((token.type === "def" && cmState.context.type === "at")
57+
|| (token.type === "variable-2" && (cmState.context.type === "top" || cmState.context.type === "block"))) {
58+
this.filter = token.string;
59+
return true;
60+
} else {
61+
this.filter = null;
62+
return false;
63+
}
64+
};
65+
66+
AtRuleHints.prototype.getHints = function (implicitChar) {
67+
var pos = this.editor.getCursorPos(),
68+
token = this.editor._codeMirror.getTokenAt(pos);
69+
70+
this.filter = token.string;
71+
this.token = token;
72+
73+
if (!this.filter) {
74+
return null;
75+
}
76+
77+
// Filter the property list based on the token string
78+
var result = Object.keys(AtRules).filter(function (key) {
79+
if (key.indexOf(token.string) === 0) {
80+
return key;
81+
}
82+
}).sort();
83+
84+
return {
85+
hints: result,
86+
match: this.filter,
87+
selectInitial: true,
88+
defaultDescriptionWidth: true,
89+
handleWideResults: false
90+
};
91+
};
92+
93+
94+
/**
95+
* Inserts a given @<rule> hint into the current editor context.
96+
*
97+
* @param {string} completion
98+
* The hint to be inserted into the editor context.
99+
*
100+
* @return {boolean}
101+
* Indicates whether the manager should follow hint insertion with an
102+
* additional explicit hint request.
103+
*/
104+
AtRuleHints.prototype.insertHint = function (completion) {
105+
var cursor = this.editor.getCursorPos();
106+
this.editor.document.replaceRange(completion, {line: cursor.line, ch: this.token.start}, {line: cursor.line, ch: this.token.end});
107+
return false;
108+
};
109+
110+
AppInit.appReady(function () {
111+
// Register code hint providers
112+
var restrictedBlockHints = new AtRuleHints();
113+
CodeHintManager.registerHintProvider(restrictedBlockHints, ["css", "less", "scss"], 0);
114+
115+
// For unit testing
116+
exports.restrictedBlockHints = restrictedBlockHints;
117+
});
118+
});

0 commit comments

Comments
 (0)