sn-collab-editor 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cb8e0571a85bf0ea7a4b0aaebf1071fc4337a0c6
4
- data.tar.gz: 06126daef55a76ee32d5285e2e286314977978fd
3
+ metadata.gz: 945bbbb91f556af904fa94727701cd482458d553
4
+ data.tar.gz: 6107768ec00cd174eb0fb40c8f5859b0aa49b2c7
5
5
  SHA512:
6
- metadata.gz: eb90203fc2900d5b9fad7cc3ca95304287141e74c8df248dda35605b1516f92c6ac87fceada175fdad97f4c7006e3c1114f284e37e5ea50b26ed76eb5dc295b7
7
- data.tar.gz: e21765f8ed8ee88f4885eb2a7710e54a96dce58c7980e6f86e03a5a267891cd5d858b602e65921d7210a4e7271f94827cbbc0b54f3247aa84dd3975cfb7ee541
6
+ metadata.gz: ea259c4d1e668f3a63ac7d728c3230f89bb4a4a9ba3491eeb765f286da42fe7cea35c12d13e346ebb90a374bfcea683d83c93217bb9ff8e207623fea5df2d845
7
+ data.tar.gz: 41f0d02bcc4f0ad415a5c13a3f8482f40c6b9a3109e9a2505b2960e6f4efe2ef9d14a0e00e461c3a05b7cc02843ba47e20c04dcae29f6c2b03e487fcadeabf23
data/README.md CHANGED
@@ -1 +1 @@
1
- More info [here](http://localhost:3002/extensions/collaborative-editor)
1
+ More information can be found on the [Standard Notes website](https://standardnotes.org/extensions/collaborative-editor).
@@ -116,26 +116,17 @@ document.addEventListener("DOMContentLoaded", function(event) {
116
116
 
117
117
  // ** Communication with Standard Notes App **
118
118
 
119
- function buildParamsString(doc) {
120
- var string = "";
121
- for(var key in doc) {
122
- string += key + ": " + doc[key] + "\n";
123
- }
124
- string += "%%Do not modify above this line%%";
125
- return string;
126
- }
127
-
128
119
  function sendDocToSN() {
129
120
  if(!isInSN) {
130
121
  return;
131
122
  }
132
123
 
133
- var noteBody = buildParamsString({url: window.location.href});
124
+ var noteBody = "";
134
125
  if(editor) {
135
- var disclaimer = "// text you enter below will not transfer to the live editor.\n// the below is just a backup for your records";
136
- noteBody += "\n\n" + disclaimer + "\n\n" + getEditorValue();
126
+ var disclaimer = "// The below is a copy of the last changes made to the doc\n// Changes you make below will not transfer over" ;
127
+ noteBody += disclaimer + "\n\n" + getEditorValue();
137
128
  }
138
- window.parent.postMessage({text: noteBody, id: noteId}, '*');
129
+ window.parent.postMessage({text: noteBody, data: {url: window.location.href}, id: noteId}, '*');
139
130
  }
140
131
 
141
132
  if(isInSN) {
@@ -149,33 +140,14 @@ document.addEventListener("DOMContentLoaded", function(event) {
149
140
  window.addEventListener("message", function(event){
150
141
  var text = event.data.text || "";
151
142
  sessionStorage.setItem("sn_lastNoteId", event.data.id);
143
+ var data = event.data.data || {};
152
144
 
153
- var splitTarget = "%%Do not modify above this line%%";
154
- var comps = text.split(splitTarget);
155
- var snText;
156
- var hasParams = text.indexOf(splitTarget) != -1;
157
- if(hasParams) {
158
- snText = comps[1];
159
- } else {
160
- snText = text;
161
- sessionStorage.setItem("sn_text", snText)
162
- }
163
-
164
-
165
- var paramString = comps[0];
166
- var params = {};
167
- var lines = paramString.split("\n");
168
- lines.forEach(function(line){
169
- var comps = line.split(": ");
170
- var key = comps[0];
171
- var value = comps[1];
172
- params[key] = value;
173
- })
174
-
175
- let url = params["url"];
145
+ let url = data.url;
176
146
  if (url) {
177
147
  window.location.href = url;
178
148
  } else {
149
+ // we're only interested in the incoming text if this is a new document, otherwise the changes are retreived from our own server
150
+ sessionStorage.setItem("sn_text", text)
179
151
  createNewDocument();
180
152
  }
181
153
  }, false);
@@ -1,3 +1,3 @@
1
1
  module Collab
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sn-collab-editor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Standard Notes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-26 00:00:00.000000000 Z
11
+ date: 2017-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails