rapier-embed 1.2.63 → 1.2.65

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.
package/README.md CHANGED
@@ -167,7 +167,7 @@ length and SHA-384 before it runs it, and keeps on the device. A file that fails
167
167
  | `elements` | The Elements sheet's traced ornaments: 3,155 pieces from the ornament book. | 16.2 MB (51 files) | `rapier.html` |
168
168
  | `lettersets` | The Gallery's letter sets: 31 sets of ornamental capitals. | 2.82 MB (31 files) | `rapier.html` |
169
169
 
170
- Totals: the reader, 9.34 MB (31.0 MB with `ocr`); `rapier.html`, 57.2 MB. Release 1.2.63.
170
+ Totals: the reader, 9.34 MB (31.0 MB with `ocr`); `rapier.html`, 57.2 MB. Release 1.2.65.
171
171
  <!-- PLUGIN_TABLE_END -->
172
172
 
173
173
  The manifest lists every plug-in file and, in `builds`, the pages that use it. `rapier.html` has flowcharts and Word import
package/embed.mjs CHANGED
@@ -180,12 +180,15 @@ function ownedPicture(bytes) {
180
180
  copy.set(bytes);
181
181
  return copy;
182
182
  }
183
- function externalImage(raw, asset, url) {
183
+ function externalImage(raw, asset, url, base) {
184
184
  if (!url) return raw;
185
185
  const token = '[' + asset.label + ']', at = raw.lastIndexOf(token);
186
186
  if (at < 0) throw refusal('asset_reference_invalid');
187
187
  const title = asset.title ? ' "' + String(asset.title).replace(/&/g, '&amp;').replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/[\r\n]/g, ' ') + '"' : '';
188
- return raw.slice(0, at) + '(<' + assetURL(url).replace(/&/g, '&amp;') + '>' + title + ')' + raw.slice(at + token.length);
188
+ let address = assetURL(url);
189
+ const folder = base ? new URL('.', base).href : '';
190
+ if (folder && address.startsWith(folder) && address.length > folder.length && !/[?#]/.test(address)) address = address.slice(folder.length);
191
+ return raw.slice(0, at) + '(<' + address.replace(/&/g, '&amp;') + '>' + title + ')' + raw.slice(at + token.length);
189
192
  }
190
193
 
191
194
  function createAssetBroker({current, send}) {
@@ -266,12 +269,12 @@ function pictureBase(value) {
266
269
  const text = String(src || '').trim();
267
270
  if (!text || /^(?:[a-z][a-z0-9+.-]*:|\/\/|#)/i.test(text)) return null;
268
271
  try { const url = new URL(text, base); if (url.origin !== base.origin) return null; vouched.add(url.href); return url.href; } catch (_) { return null; }
269
- }, {vouched});
272
+ }, {vouched, base: base.href});
270
273
  }
271
274
  return {FEATURES, LIMITS, ASSET_TYPES, refusal, coded, normalizeSettings, snapshotSettings, pickDeviceFile, createFilePicker, assetURL, assetBytes, bytesHash, externalImage, createAssetBroker, pictureBase};
272
275
  })();
273
276
  const BUILDS = Object.freeze({full: 'https://rapier.website/embed/rapier.html', reader: 'https://rapier.website/embed/rapier-reader.html'});
274
- const PACKAGE_VERSION = '1.2.63';
277
+ const PACKAGE_VERSION = '1.2.65';
275
278
  const OPTIONS = ['build', 'src', 'plugins', 'approvePlugins', 'sessionId', 'documentId', 'agent', 'agentName', 'theme', 'save', 'assets', 'openFile', 'load',
276
279
  'onState', 'compare', 'onClose', 'settings', 'style', 'title', 'onError', 'timeout'];
277
280
  const READER_FEATURES = ['find', 'readAloud', 'share'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rapier-embed",
3
- "version": "1.2.63",
3
+ "version": "1.2.65",
4
4
  "description": "Embed the Rapier Markdown editor or its lightweight reader (about 360 kB) in your web app. Runs offline from your own copy, saves to your storage, and takes your CSS and fonts. Your app's AI agent edits directly over WebMCP under the Will. MIT, no dependencies.",
5
5
  "keywords": [
6
6
  "markdown",