From d1b91d0e42a57148ee84c6acc14e1e532e458a0c Mon Sep 17 00:00:00 2001 From: WM Chang Date: Mon, 22 Sep 2014 13:15:10 +0800 Subject: [PATCH 1/2] fix InlineImageViewer example extension --- .../samples/InlineImageViewer/InlineImageViewer.html | 4 ++-- src/extensions/samples/InlineImageViewer/main.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/extensions/samples/InlineImageViewer/InlineImageViewer.html b/src/extensions/samples/InlineImageViewer/InlineImageViewer.html index b173e3cf641..92d694df553 100644 --- a/src/extensions/samples/InlineImageViewer/InlineImageViewer.html +++ b/src/extensions/samples/InlineImageViewer/InlineImageViewer.html @@ -1,4 +1,4 @@
-
+
-
\ No newline at end of file + diff --git a/src/extensions/samples/InlineImageViewer/main.js b/src/extensions/samples/InlineImageViewer/main.js index 7dfce389375..7188f15e8ef 100644 --- a/src/extensions/samples/InlineImageViewer/main.js +++ b/src/extensions/samples/InlineImageViewer/main.js @@ -47,7 +47,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); } From 376c03b363e2c5f45200408263cadbacdc44690e Mon Sep 17 00:00:00 2001 From: WM Chang Date: Sun, 22 Mar 2015 11:29:15 +0800 Subject: [PATCH 2/2] separate style of inline image viewer --- .../samples/InlineImageViewer/InlineImageViewer.html | 6 +++--- src/extensions/samples/InlineImageViewer/main.js | 2 ++ src/extensions/samples/InlineImageViewer/style.css | 11 +++++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 src/extensions/samples/InlineImageViewer/style.css diff --git a/src/extensions/samples/InlineImageViewer/InlineImageViewer.html b/src/extensions/samples/InlineImageViewer/InlineImageViewer.html index 92d694df553..c6d8f549e1e 100644 --- a/src/extensions/samples/InlineImageViewer/InlineImageViewer.html +++ b/src/extensions/samples/InlineImageViewer/InlineImageViewer.html @@ -1,4 +1,4 @@ -
-
- +
+
+
diff --git a/src/extensions/samples/InlineImageViewer/main.js b/src/extensions/samples/InlineImageViewer/main.js index 7188f15e8ef..227dbd30f04 100644 --- a/src/extensions/samples/InlineImageViewer/main.js +++ b/src/extensions/samples/InlineImageViewer/main.js @@ -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 @@ -130,5 +131,6 @@ define(function (require, exports, module) { return result.promise(); } + ExtensionUtils.loadStyleSheet(module, "style.css"); EditorManager.registerInlineEditProvider(inlineImageViewerProvider); }); diff --git a/src/extensions/samples/InlineImageViewer/style.css b/src/extensions/samples/InlineImageViewer/style.css new file mode 100644 index 00000000000..6dff6d02e26 --- /dev/null +++ b/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; +} \ No newline at end of file