2016-04-25 23 views
0

嘗試獲取簡單版本的codemirror並運行,但當我在兩個差異瀏覽器(或incog中的一個文檔)上訪問文檔時,出現此錯誤控制檯:CodeMirror問題:解析正向通道時出錯錯誤:transformData上的無效映射

錯誤解析前向信道錯誤:在transformData

無效地圖這是兩個差異的用戶登錄和訪問相同的文檔。當沒有人登錄時工作得很好,它只是訪問文檔的兩個差異瀏覽器。我按照root的指示設置了settings.json文件,並且我正在運行meteor 1.2.1,因爲這是仍然適用於Sharejs的版本。我使用:meteor --release 1.2.1 --settings settings.json。

{ 
"sharejs": { 
"options": { 
     "accounts_auth": { 
     "authorize": { 
      "collection": "documents", 
      "token_validations": { 
       "or": { 
       "invitedUsers": "is_in_array", 
       "userId": "is_equal" 
       } 
      }, 
      "apply_on": [ 
       "read", 
       "update", 
       "create", 
       "delete" 
      ] 
     }, 
     "authenticate": { 
      "collection": "users", 
      "token_validations": { 
       "_id": "is_equal" 
      } 
     } 
     } 
    } 
    } 
} 

在HTML當文檔渲染都具有正確的文檔ID(即在同一文檔ID)......但顯然我沒有看到文字的鏡像。

使用簡單的codemirror版本({{> sharejsCM docid=docid id="editor"}}

任何想法?

回答

0

查覈在https://www.coursera.org/learn/web-application-development/lecture/QAxTR/textcircle 代碼的例子是:textcircle.html:

<head> 
    <title>Text Circle</title> 
</head> 
<body> 
    <h1>Welcome to Text Circle - a Collaboration Tool.</h1> 
    {{> editor}} 
</body> 
<template name="editor"> 
    {{> sharejsCM docid=docId id="Editor"}} 
</template> 

---- textcircle.js:

this.Documents = new Mongo.Collection("documents"); 

if (Meteor.isClient) { 
    Template.editor.helpers({ 
    docId: function() { 
     var doc = Documents.findOne(); 
     if (doc) { 
     return doc._id; 
     } else { 
     return null; 
     } 
    } 
    }) 
} 

if (Meteor.isServer){ 
    Meteor.startup(function(){ 
     // code to run on server at startup 
    if (! Documents.findOne()) { // No docs yet. 
     Documents.insert({title: "My new documents."}) 
    } 
    }) 
} 

我還不知道什麼ID =「編輯器」。我在這裏將其更改爲id =「Editor」,甚至將其刪除,兩個窗口之間的結果沒有察覺到不同。

相關問題