i18n_proofreading 0.9.6 → 0.9.7

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
  SHA256:
3
- metadata.gz: db16831c9e129156f2c1a82da43814e14b97936386b1d3581abf5570f91ad410
4
- data.tar.gz: 0322afe3ad6bc27a811ca7371618533989df233dfc1b793f8c4eae43f05f47af
3
+ metadata.gz: 71c3ef13d9eb7688953deaa41e98490084aef787abe305c4cac15bcad61cfe6d
4
+ data.tar.gz: 7c8d967ece7913135833ca2848e02851a3f54487e380ec6add21002373fca9bc
5
5
  SHA512:
6
- metadata.gz: 759e0b8b70bf290d3e2a81f4aef47815cd8b66286dfdb467afc1f83b17d0472bd225ad09c136cf6a206c37cf13682b98a4f582cf3acf29644028365b92d0a8a2
7
- data.tar.gz: 6cf3c8b3f15fd4d7170da8d3029f78e001586f097099d2014849740ea213161ec8f7faf2b0c756abd4edfcae2bf989df1a6794792a43fd74fb0ea779a5778cbb
6
+ metadata.gz: 140f6f111eb68a553b1bc394b76e198e855dd55d742dcb77008282610634bc95135a6a4a41406c029d3d58a0fd0c538cb8ff2370cd6d478c5b9e8567342d2063
7
+ data.tar.gz: 999d1079f6e426fe8b92a9ffc37f3779621992ff40cd28c3f36b76999581506bbfaa89ec613b5792ef26ebb76852d1c1361280dd7411a232f6245343ec1e3713
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.9.7]
6
+
7
+ - The widget's injected stylesheet now refreshes when its content changes
8
+ instead of once-and-never-again — so a shipped widget update takes effect on
9
+ the next Turbo visit instead of needing a full page reload (Turbo keeps
10
+ `<head>` across visits, which could otherwise pin old CSS while fresh
11
+ widget.js runs). Backported from livechat 0.4.5.
12
+
5
13
  ## [0.9.6]
6
14
 
7
15
  - No more flash of raw `⟦key⟧` markers when entering suggest mode: the widget
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module I18nProofreading
4
- VERSION = '0.9.6'
4
+ VERSION = '0.9.7'
5
5
  end
@@ -446,10 +446,7 @@
446
446
  // --- styles ---------------------------------------------------------------
447
447
 
448
448
  function injectStyles() {
449
- if (document.getElementById("i18np-styles")) return;
450
- var style = document.createElement("style");
451
- style.id = "i18np-styles";
452
- style.textContent = [
449
+ var css = [
453
450
  // Only the strings that actually resolve to a key are editable, so only
454
451
  // those are highlighted. `outline` (not `border`) avoids any layout shift.
455
452
  ".i18np-active [data-i18n-key] { cursor: copy; outline: 1px dashed rgba(37, 99, 235, 0.5); outline-offset: 2px; }",
@@ -523,6 +520,17 @@
523
520
  " .i18np-panel .i18np-actions { padding-bottom: calc(0px + env(safe-area-inset-bottom)); }",
524
521
  "}",
525
522
  ].join("\n");
523
+
524
+ // Re-inject only when the CSS changed. Turbo keeps <head> across visits, so
525
+ // a stale <style> would otherwise pin old CSS after a shipped update, even
526
+ // while fresh widget.js runs — as self-freshening as the fingerprinted URL.
527
+ var existing = document.getElementById("i18np-styles");
528
+ if (existing && existing.textContent === css) return;
529
+ if (existing) existing.remove();
530
+
531
+ var style = document.createElement("style");
532
+ style.id = "i18np-styles";
533
+ style.textContent = css;
526
534
  document.head.appendChild(style);
527
535
  }
528
536
  })();
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n_proofreading
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6
4
+ version: 0.9.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yaroslav Shmarov