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

Commit

Permalink
fix InlineImageViewer example extension (#9191)
Browse files Browse the repository at this point in the history
* fix InlineImageViewer example extension

* separate style of inline image viewer
  • Loading branch information
kidwm authored and ficristo committed Oct 30, 2016
1 parent e78688a commit 4697485
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
@@ -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
Expand Up @@ -28,6 +28,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 @@ -45,7 +46,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 @@ -128,5 +129,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
@@ -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;
}

0 comments on commit 4697485

Please sign in to comment.