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

fix InlineImageViewer example extension #9191

Merged
merged 2 commits into from
Oct 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div>
<div class="filename"><span/></div>
<img style="display: block; margin: 20px auto; opacity: 0;"/>
</div>
<div class="inline-image-viewer">
<div class="filename"><span /></div>
<img class="image" />
</div>
4 changes: 3 additions & 1 deletion src/extensions/samples/InlineImageViewer/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ define(function (require, exports, module) {

// Brackets modules
var EditorManager = brackets.getModule("editor/EditorManager"),
ExtensionUtils = brackets.getModule("utils/ExtensionUtils"),
ProjectManager = brackets.getModule("project/ProjectManager");

// Local modules
Expand All @@ -47,7 +48,7 @@ define(function (require, exports, module) {

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

Expand Down Expand Up @@ -130,5 +131,6 @@ define(function (require, exports, module) {
return result.promise();
}

ExtensionUtils.loadStyleSheet(module, "style.css");
EditorManager.registerInlineEditProvider(inlineImageViewerProvider);
});
11 changes: 11 additions & 0 deletions src/extensions/samples/InlineImageViewer/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.inline-image-viewer .filename {
text-align: right;
padding-right: 1.5em;
line-height: 32px;
}

.inline-image-viewer .image {
display: block;
margin: 0 auto;
opacity: 0;
}