Skip to content

Commit 50999a9

Browse files
committed
Merge pull request #49 from google/ddc_strong_mode
strong mode
2 parents 19bb9c5 + ef78ad7 commit 50999a9

File tree

5 files changed

+27
-7
lines changed

5 files changed

+27
-7
lines changed

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 0.2.9
4+
- made ddc (strong mode) compliant
5+
- fixed an issues returning the TextMarker positions of bookmarks
6+
37
## 0.2.8
48
- updated to CodeMirror 5.5.0
59
- expose `defineExtension` and `defineDocExtension`

lib/codemirror.dart

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,21 +1109,32 @@ class TextMarker extends ProxyHolder {
11091109
/**
11101110
* Returns a {from, to} object (both holding document positions), indicating
11111111
* the current position of the marked range, or `null` if the marker is no
1112-
* longer in the document.
1112+
* longer in the document. For a bookmark, this list will be length 1.
11131113
*/
11141114
List<Position> find() {
11151115
var result = call('find');
11161116
if (result is! JsObject) return null;
1117+
11171118
try {
1118-
return [
1119-
new Position.fromProxy(result['from']),
1120-
new Position.fromProxy(result['to'])
1121-
];
1119+
if (result is List) {
1120+
return [
1121+
new Position.fromProxy(result['from']),
1122+
new Position.fromProxy(result['to'])
1123+
];
1124+
} else {
1125+
return [new Position.fromProxy(result)];
1126+
}
11221127
} catch (e) {
11231128
return null;
11241129
}
11251130
}
11261131

1132+
/// Return the first (or only) position in this marker / bookmark.
1133+
Position findStart() {
1134+
List<Position> positions = find();
1135+
return (positions == null || positions.isEmpty) ? null : positions.first;
1136+
}
1137+
11271138
/**
11281139
* Call if you've done something that might change the size of the marker (for
11291140
* example changing the content of a replacedWith node), and want to cheaply

lib/hints.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class Hints {
6565
_init();
6666

6767
JsFunction function = new JsFunction.withThis((win, editor, showHints, [options]) {
68-
var results = helper(new CodeMirror.fromJsObject(editor),
68+
dynamic results = helper(new CodeMirror.fromJsObject(editor),
6969
new HintsOptions.fromProxy(options));
7070

7171
if (results is Future) {

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# license that can be found in the LICENSE file.
44

55
name: codemirror
6-
version: 0.2.8+5.5.0
6+
version: 0.2.9+5.5.0
77
description: A Dart wrapper around the CodeMirror text editor.
88
author: Devon Carew <[email protected]>
99
homepage: https://github.com/google/codemirror.dart

tool/travis.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,10 @@ dart tool/grind.dart build
1414
pub global activate tuneup
1515
pub global run tuneup check
1616

17+
# And that DDC is happy with it.
18+
pub global activate dev_compiler
19+
pub global run dev_compiler lib/codemirror.dart
20+
pub global run dev_compiler lib/hints.dart
21+
1722
# Run the tests.
1823
#dart test/all.dart

0 commit comments

Comments
 (0)