@internetarchive/bookreader 5.0.0-61 → 5.0.0-63

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.
@@ -1,41 +1,70 @@
1
- .textSelectionSVG {
1
+ .BRtextLayer {
2
2
  z-index: 2;
3
-
4
- // Make it so right-clicking on "blank" part of svg sends events to the image (for saving)
3
+ position: absolute;
4
+ top: 0;
5
+ left: 0;
6
+ color: transparent;
7
+ transform-origin: 0 0;
8
+ // Make it so right-clicking on "blank" part of text layer sends events to the image (for saving)
5
9
  pointer-events: none;
6
- .BRwordElement { pointer-events: all; }
7
- &.selectingSVG {
8
- pointer-events: auto;
9
- cursor: text;
10
- }
11
-
12
- // Highlight colors for text selection layer ( these 2 properties do not work if joined)
13
- .BRwordElement::selection {
10
+ cursor: text;
11
+ }
12
+
13
+ .BRparagraphElement {
14
+ margin: 0;
15
+ cursor: text;
16
+ font-family: Georgia, serif;
17
+ line-height: 0;
18
+ }
19
+
20
+ .BRlineElement {
21
+ pointer-events: all;
22
+ white-space: nowrap;
23
+ display: inline-block;
24
+
25
+ // We use display: inline-block, otherwise this causes every line
26
+ // to have newlines at the end in safari. BUT, since they're inline,
27
+ // if the OCR has to short line in the same paragraph, they can wrap
28
+ // and one can go onto the other. This adds an arbitrary margin to
29
+ // the right of each line, forcing things to wrap.
30
+ // See eg https://www-drini.archive.org/details/countofmontecris00duma_7/page/261/mode/2up
31
+ // Page 261, second last line on the page.
32
+ .BRtextLayer[dir=ltr] & { margin-right: 100%; }
33
+ .BRtextLayer[dir=rtl] & { margin-left: 100%; }
34
+ }
35
+
36
+ // Highlight colors for text selection layer
37
+ .BRwordElement, .BRspace, .BRparagraphElement, .BRparagraphElement br {
38
+ // these 2 properties do not work if joined
39
+ &::selection {
14
40
  background: hsla(210, 74%, 62%, 0.4);
15
41
  }
16
- .BRwordElement::-moz-selection {
42
+
43
+ &::-moz-selection {
17
44
  background: hsla(210, 74%, 62%, 0.4);
18
- color: transparent;
45
+ color:transparent;
19
46
  }
47
+ }
20
48
 
21
- .BRparagElement {
22
- fill: transparent;
23
- cursor: text;
24
- white-space: pre;
25
- font-family: Georgia, serif;
26
- }
49
+ .BRparagraphElement br {
50
+ visibility: hidden;
51
+ }
52
+
53
+ // Use CSS pseudo-elements to render the hyphens. This makes them
54
+ // not selectable, so copy/pasting text doesn't include them.
55
+ .BRwordElement--hyphen::after {
56
+ content: "-";
27
57
  }
28
58
 
29
59
  // Hide text layer for performance during zooming & scrolling
30
60
  .BRsmooth-zooming, .BRscrolling-active {
31
- .textSelectionSVG {
61
+ .BRpagecontainer:not(.BRpagecontainer--hasSelection) .BRtextLayer {
32
62
  display: none;
33
63
  }
34
64
  }
35
65
 
36
- // Hide text selection layers of off-screen pages, and only display
37
- // 2 text layers regardless of zoom level
38
- .BRmode1up .BRpagecontainer:not(.BRpage-visible) .textSelectionSVG {
66
+ // Hide text selection layers of off-screen pages
67
+ .BRmode1up .BRpagecontainer:not(.BRpage-visible) .BRtextLayer {
39
68
  display: none;
40
69
  }
41
70
 
@@ -45,3 +74,35 @@
45
74
  -moz-user-select: none;
46
75
  user-select: none;
47
76
  }
77
+
78
+
79
+ // These are Microsoft Edge specific fixed to make some of the
80
+ // browsers features work well. These are for the in-place
81
+ // translation.
82
+ .BRwordElement, .BRspace {
83
+ &[_istranslated="1"], &[_msttexthash] {
84
+ background-color: #e4dccd;
85
+ color: black;
86
+ letter-spacing: unset !important;
87
+ background: #ccbfa7;
88
+ }
89
+ }
90
+
91
+ .BRlineElement font[_mstmutation="1"] {
92
+ background: #ccbfa7;
93
+ }
94
+
95
+ .BRlineElement:has([_istranslated="1"], [_msttexthash]) {
96
+ background-color: #e4dccd;
97
+ color: black;
98
+ text-align: justify;
99
+ width: inherit;
100
+ &:not(:nth-last-child(2)) {
101
+ text-align-last: justify;
102
+ }
103
+ }
104
+
105
+ .BRlineElement[_msttexthash] {
106
+ background: #ccbfa7;
107
+ word-spacing: unset !important;
108
+ }