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

Commit 4697485

Browse files
kidwmficristo
authored andcommitted
fix InlineImageViewer example extension (#9191)
* fix InlineImageViewer example extension * separate style of inline image viewer
1 parent e78688a commit 4697485

3 files changed

Lines changed: 18 additions & 5 deletions

File tree

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div>
2-
<div class="filename"><span/></div>
3-
<img style="display: block; margin: 20px auto; opacity: 0;"/>
4-
</div>
1+
<div class="inline-image-viewer">
2+
<div class="filename"><span /></div>
3+
<img class="image" />
4+
</div>

src/extensions/samples/InlineImageViewer/main.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ define(function (require, exports, module) {
2828

2929
// Brackets modules
3030
var EditorManager = brackets.getModule("editor/EditorManager"),
31+
ExtensionUtils = brackets.getModule("utils/ExtensionUtils"),
3132
ProjectManager = brackets.getModule("project/ProjectManager");
3233

3334
// Local modules
@@ -45,7 +46,7 @@ define(function (require, exports, module) {
4546

4647
// If the pos is at the beginning of a name, token will be the
4748
// preceding whitespace or dot. In that case, try the next pos.
48-
if (!/\S/.match(token.string) || token.string === ".") {
49+
if (!/\S/.test(token.string) || token.string === ".") {
4950
token = hostEditor._codeMirror.getTokenAt({line: pos.line, ch: pos.ch + 1}, true);
5051
}
5152

@@ -128,5 +129,6 @@ define(function (require, exports, module) {
128129
return result.promise();
129130
}
130131

132+
ExtensionUtils.loadStyleSheet(module, "style.css");
131133
EditorManager.registerInlineEditProvider(inlineImageViewerProvider);
132134
});
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.inline-image-viewer .filename {
2+
text-align: right;
3+
padding-right: 1.5em;
4+
line-height: 32px;
5+
}
6+
7+
.inline-image-viewer .image {
8+
display: block;
9+
margin: 0 auto;
10+
opacity: 0;
11+
}

0 commit comments

Comments
 (0)