OLD | NEW |
---|---|
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library trydart.interaction_manager; | 5 library trydart.interaction_manager; |
6 | 6 |
7 import 'dart:html'; | 7 import 'dart:html'; |
8 | 8 |
9 import 'dart:convert' show | 9 import 'dart:convert' show |
10 JSON; | 10 JSON; |
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1227 node.replaceWith(newNode); | 1227 node.replaceWith(newNode); |
1228 if (selectionOffset != -1) { | 1228 if (selectionOffset != -1) { |
1229 selection.anchorNode = newNode; | 1229 selection.anchorNode = newNode; |
1230 selection.anchorOffset = selectionOffset; | 1230 selection.anchorOffset = selectionOffset; |
1231 } | 1231 } |
1232 } | 1232 } |
1233 if (!record.removedNodes.isEmpty) { | 1233 if (!record.removedNodes.isEmpty) { |
1234 var first = record.removedNodes.first; | 1234 var first = record.removedNodes.first; |
1235 var line = findLine(record.target); | 1235 var line = findLine(record.target); |
1236 | 1236 |
1237 if (first is Text && first.data=="\n" && line.nextNode != null) { | 1237 if (first is Text && line.nextNode != null) { |
ahe
2014/09/04 11:42:36
Does this have a significant impact on when we can
aam-me
2014/09/04 12:01:06
Your question is about impact in those cases when
ahe
2014/09/04 12:11:10
I normally just look at the console and make some
| |
1238 normalizedNodes.add(line.nextNode); | 1238 normalizedNodes.add(line.nextNode); |
1239 } | 1239 } |
1240 normalizedNodes.add(line); | 1240 normalizedNodes.add(line); |
1241 } | 1241 } |
1242 if (record.type == "characterData" && record.target.parentNode != null) { | 1242 if (record.type == "characterData" && record.target.parentNode != null) { |
1243 // At least Firefox sends a "characterData" record whose target is the | 1243 // At least Firefox sends a "characterData" record whose target is the |
1244 // deleted text node. It also sends a record where "removedNodes" isn't | 1244 // deleted text node. It also sends a record where "removedNodes" isn't |
1245 // empty whose target is the parent (which we are interested in). | 1245 // empty whose target is the parent (which we are interested in). |
1246 normalizedNodes.add(findLine(record.target)); | 1246 normalizedNodes.add(findLine(record.target)); |
1247 } | 1247 } |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1342 token = token.next; | 1342 token = token.next; |
1343 kind = token.kind; | 1343 kind = token.kind; |
1344 } | 1344 } |
1345 return token; | 1345 return token; |
1346 } | 1346 } |
1347 | 1347 |
1348 String extractQuote(String string) { | 1348 String extractQuote(String string) { |
1349 StringQuoting q = StringValidator.quotingFromString(string); | 1349 StringQuoting q = StringValidator.quotingFromString(string); |
1350 return (q.raw ? 'r' : '') + (q.quoteChar * q.leftQuoteLength); | 1350 return (q.raw ? 'r' : '') + (q.quoteChar * q.leftQuoteLength); |
1351 } | 1351 } |
OLD | NEW |