(doc, f, sharedHistOnly)
| 73 | |
| 74 | // Call f for all linked documents. |
| 75 | export function linkedDocs(doc, f, sharedHistOnly) { |
| 76 | function propagate(doc, skip, sharedHist) { |
| 77 | if (doc.linked) for (let i = 0; i < doc.linked.length; ++i) { |
| 78 | let rel = doc.linked[i] |
| 79 | if (rel.doc == skip) continue |
| 80 | let shared = sharedHist && rel.sharedHist |
| 81 | if (sharedHistOnly && !shared) continue |
| 82 | f(rel.doc, shared) |
| 83 | propagate(rel.doc, doc, shared) |
| 84 | } |
| 85 | } |
| 86 | propagate(doc, null, true) |
| 87 | } |
| 88 | |
| 89 | // Attach a document to an editor. |
| 90 | export function attachDoc(cm, doc) { |
no test coverage detected