tangled
alpha
login
or
join now
margin.at
/
margin
89
fork
atom
Write on the margins of the internet. Powered by the AT Protocol.
margin.at
extension
web
atproto
comments
89
fork
atom
overview
issues
4
pulls
1
pipelines
fix annotations not working on extension
scanash.com
1 month ago
dcf85bad
8e147eb2
+8
-7
2 changed files
expand all
collapse all
unified
split
extension
src
entrypoints
content.ts
utils
api.ts
+5
-1
extension/src/entrypoints/content.ts
···
200
200
submitBtn.textContent = 'Posting...';
201
201
202
202
try {
203
203
-
await sendMessage('createAnnotation', {
203
203
+
const res = await sendMessage('createAnnotation', {
204
204
url: window.location.href,
205
205
title: document.title,
206
206
text,
207
207
selector: { type: 'TextQuoteSelector', exact: quoteText },
208
208
});
209
209
+
210
210
+
if (!res.success) {
211
211
+
throw new Error(res.error || 'Unknown error');
212
212
+
}
209
213
210
214
showToast('Annotation created!', 'success');
211
215
composeModal?.remove();
+3
-6
extension/src/utils/api.ts
···
132
132
const res = await apiRequest('/annotations', {
133
133
method: 'POST',
134
134
body: JSON.stringify({
135
135
-
target: {
136
136
-
source: data.url,
137
137
-
selector: data.selector,
138
138
-
},
139
139
-
body: { type: 'TextualBody', value: data.text, format: 'text/plain' },
140
140
-
motivation: 'commenting',
135
135
+
url: data.url,
136
136
+
text: data.text,
141
137
title: data.title,
138
138
+
selector: data.selector,
142
139
}),
143
140
});
144
141