sn-collab-editor 0.2.3 → 0.3.0

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
- SHA1:
3
- metadata.gz: 945bbbb91f556af904fa94727701cd482458d553
4
- data.tar.gz: 6107768ec00cd174eb0fb40c8f5859b0aa49b2c7
2
+ SHA256:
3
+ metadata.gz: c0a98d64abe58588655852b1d68f8eb4efcb2c5db01a2e35dfea0b3c265ff290
4
+ data.tar.gz: bcaa52bfd373b2048a1c7abf64f908a5b7b0e9c393ea62c7c5a8141550a4d78d
5
5
  SHA512:
6
- metadata.gz: ea259c4d1e668f3a63ac7d728c3230f89bb4a4a9ba3491eeb765f286da42fe7cea35c12d13e346ebb90a374bfcea683d83c93217bb9ff8e207623fea5df2d845
7
- data.tar.gz: 41f0d02bcc4f0ad415a5c13a3f8482f40c6b9a3109e9a2505b2960e6f4efe2ef9d14a0e00e461c3a05b7cc02843ba47e20c04dcae29f6c2b03e487fcadeabf23
6
+ metadata.gz: e769f65aed5c5fe70515421c74932a52d1760febe287414c94105de4b01679cfeaa1de5bfdf71c9e9866602f8e5c0f0bcd8fbdf9d1f2db47199105c19f5ba876
7
+ data.tar.gz: 8659819a8f4e464d463b8b0c7a7ef7a528825cb6b36894f1a2e6f86a2ec8309b17503ca1b8094e4a3a804fd6a71d1f5d1ca1aeac1a01736f2fe5e8fdb50fdad5
@@ -116,17 +116,26 @@ 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
+
119
128
  function sendDocToSN() {
120
129
  if(!isInSN) {
121
130
  return;
122
131
  }
123
132
 
124
- var noteBody = "";
133
+ var noteBody = buildParamsString({url: window.location.href});
125
134
  if(editor) {
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();
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();
128
137
  }
129
- window.parent.postMessage({text: noteBody, data: {url: window.location.href}, id: noteId}, '*');
138
+ window.parent.postMessage({text: noteBody, id: noteId}, '*');
130
139
  }
131
140
 
132
141
  if(isInSN) {
@@ -140,14 +149,33 @@ document.addEventListener("DOMContentLoaded", function(event) {
140
149
  window.addEventListener("message", function(event){
141
150
  var text = event.data.text || "";
142
151
  sessionStorage.setItem("sn_lastNoteId", event.data.id);
143
- var data = event.data.data || {};
144
152
 
145
- let url = data.url;
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"];
146
176
  if (url) {
147
177
  window.location.href = url;
148
178
  } 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)
151
179
  createNewDocument();
152
180
  }
153
181
  }, false);
@@ -1,3 +1,3 @@
1
1
  module Collab
2
- VERSION = '0.2.3'
2
+ VERSION = '0.3.0'
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.3
4
+ version: 0.3.0
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-27 00:00:00.000000000 Z
11
+ date: 2020-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 5.0.1
19
+ version: '5'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 5.0.1
26
+ version: '5'
27
27
  description: Standard Notes editor with collaboration abilities.
28
28
  email:
29
29
  - hello@standardnotes.org
@@ -90,8 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
92
  requirements: []
93
- rubyforge_project:
94
- rubygems_version: 2.4.8
93
+ rubygems_version: 3.0.3
95
94
  signing_key:
96
95
  specification_version: 4
97
96
  summary: Standard Notes editor with collaboration abilities.