markdownr 0.5.16 → 0.5.17

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: 9701699dcaa5bb10ddddcff543dace0bc75184e86529ac048efbb0337e61b63c
4
- data.tar.gz: 5156b2929f5c6195007c2755d387c6df17f0b33e8ca162045bad9f0618bec62a
3
+ metadata.gz: 9044a1bee7c704aad77abde049a1e46063496e5e42c3a5f09ec5184bff42bb10
4
+ data.tar.gz: bd1168ac32f70f7df78b6a6bc047cdb1a7331dc9813ffc38636ff080116d6c52
5
5
  SHA512:
6
- metadata.gz: d77b2e509c1516c496f05f134f342d083d5e6c007d24796dfe370f8f0884aca81f62885e02b111f222e630e28d644674a6839225c711219d3dee702c4dd93faf
7
- data.tar.gz: e7dd49dc45652b516b688e4066c0577cfb4ed39f5e7bb314de40366d85680e82403a74d6bf244ce75ce6228f157c7c47a960667c2de0c46fed6696fd83b64e86
6
+ metadata.gz: eaca881e0e2e9fa996381cb944fb9ade2c26dcb09dff96d1d595dfbc79d1150b7024f138086e2b58e255ae79d12d1580ed68298480a9cf209adca8cc77cae80c
7
+ data.tar.gz: 93a40be77ea08b3aa335b8c84e6c4741a962a6851c29abd851a99c5698f504fb9bca5d9a1e179a0d859797d08db56c92691f8cec2ea9a293c082a87f80bce8b8
@@ -1,3 +1,3 @@
1
1
  module MarkdownServer
2
- VERSION = "0.5.16"
2
+ VERSION = "0.5.17"
3
3
  end
data/views/layout.erb CHANGED
@@ -756,16 +756,16 @@
756
756
  width: 460px;
757
757
  max-width: calc(100vw - 16px);
758
758
  max-height: 60vh;
759
- overflow-y: auto;
760
759
  background: #faf8f4;
761
760
  border: 1px solid #d4b96a;
762
761
  border-radius: 6px;
763
762
  box-shadow: 0 4px 20px rgba(0,0,0,0.22);
764
- -webkit-overflow-scrolling: touch;
765
763
  cursor: auto;
766
- resize: both;
767
764
  min-width: 280px;
768
765
  min-height: 80px;
766
+ display: flex;
767
+ flex-direction: column;
768
+ overflow: hidden;
769
769
  }
770
770
  .link-ctx-popup-header {
771
771
  display: flex;
@@ -774,10 +774,8 @@
774
774
  gap: 0.5rem;
775
775
  padding: 0.5rem 0.9rem;
776
776
  border-bottom: 1px solid #e0d8c8;
777
- position: sticky;
778
- top: 0;
779
777
  background: #faf8f4;
780
- z-index: 1;
778
+ flex-shrink: 0;
781
779
  cursor: grab;
782
780
  }
783
781
  .link-ctx-popup-header.is-dragging {
@@ -854,6 +852,22 @@
854
852
  }
855
853
  .link-ctx-popup-body {
856
854
  padding: 0.75rem 1rem;
855
+ flex: 1;
856
+ min-height: 0;
857
+ overflow-y: auto;
858
+ -webkit-overflow-scrolling: touch;
859
+ }
860
+ .link-ctx-popup-resize {
861
+ position: absolute;
862
+ bottom: 0;
863
+ right: 0;
864
+ width: 20px;
865
+ height: 20px;
866
+ cursor: nwse-resize;
867
+ touch-action: none;
868
+ border-bottom-right-radius: 5px;
869
+ background: repeating-linear-gradient(-45deg, transparent, transparent 2px, rgba(0,0,0,0.18) 2px, rgba(0,0,0,0.18) 3px);
870
+ z-index: 2;
857
871
  }
858
872
  .link-ctx-popup-url {
859
873
  font-family: "SF Mono", Menlo, Consolas, monospace;
@@ -1672,7 +1686,8 @@
1672
1686
  '<button class="link-ctx-popup-pin" aria-label="Pin" title="Pin popup">' + pinIcon + '</button>' +
1673
1687
  '<button class="link-ctx-popup-close" aria-label="Close">\u00d7</button>' +
1674
1688
  '</div>' +
1675
- '<div class="link-ctx-popup-body">' + bodyHtml + '</div>';
1689
+ '<div class="link-ctx-popup-body">' + bodyHtml + '</div>' +
1690
+ '<div class="link-ctx-popup-resize" aria-hidden="true"></div>';
1676
1691
  document.body.appendChild(popup);
1677
1692
 
1678
1693
  clearTimeout(mouseLeaveTimer);
@@ -1687,13 +1702,7 @@
1687
1702
 
1688
1703
  repositionPopup();
1689
1704
  makeDraggable(popup);
1690
- // Lock explicit dimensions on first interaction so resize can grow past max-height
1691
- thisPopup.addEventListener('mousedown', function lockSize() {
1692
- thisPopup.style.width = thisPopup.offsetWidth + 'px';
1693
- thisPopup.style.height = thisPopup.offsetHeight + 'px';
1694
- thisPopup.style.maxHeight = 'none';
1695
- thisPopup.removeEventListener('mousedown', lockSize);
1696
- }, true);
1705
+ makeResizable(popup);
1697
1706
  runMermaidIn(popup);
1698
1707
 
1699
1708
  var backBtnEl = popup.querySelector('.link-ctx-popup-back');
@@ -1851,27 +1860,95 @@
1851
1860
  var header = el.querySelector('.link-ctx-popup-header');
1852
1861
  if (!header) return;
1853
1862
  var startX, startY, startLeft, startTop;
1854
- header.addEventListener('mousedown', function(e) {
1855
- if (e.target.closest('button') || e.target.closest('a')) return;
1856
- e.preventDefault();
1857
- startX = e.clientX;
1858
- startY = e.clientY;
1859
- startLeft = el.offsetLeft;
1860
- startTop = el.offsetTop;
1863
+
1864
+ function onDragStart(clientX, clientY) {
1865
+ startX = clientX; startY = clientY;
1866
+ startLeft = el.offsetLeft; startTop = el.offsetTop;
1867
+ el.style.width = el.offsetWidth + 'px';
1868
+ el.style.height = el.offsetHeight + 'px';
1869
+ el.style.maxHeight = 'none';
1861
1870
  popupDragging = true;
1862
1871
  header.classList.add('is-dragging');
1863
- document.addEventListener('mousemove', onMove);
1864
- document.addEventListener('mouseup', onUp);
1865
- });
1866
- function onMove(e) {
1867
- el.style.left = (startLeft + e.clientX - startX) + 'px';
1868
- el.style.top = (startTop + e.clientY - startY) + 'px';
1869
1872
  }
1870
- function onUp() {
1873
+ function onDragMove(clientX, clientY) {
1874
+ el.style.left = (startLeft + clientX - startX) + 'px';
1875
+ el.style.top = (startTop + clientY - startY) + 'px';
1876
+ }
1877
+ function onDragEnd() {
1871
1878
  popupDragging = false;
1872
1879
  header.classList.remove('is-dragging');
1873
- document.removeEventListener('mousemove', onMove);
1874
- document.removeEventListener('mouseup', onUp);
1880
+ }
1881
+
1882
+ header.addEventListener('mousedown', function(e) {
1883
+ if (e.target.closest('button') || e.target.closest('a')) return;
1884
+ e.preventDefault();
1885
+ onDragStart(e.clientX, e.clientY);
1886
+ document.addEventListener('mousemove', onMouseMove);
1887
+ document.addEventListener('mouseup', onMouseUp);
1888
+ });
1889
+ function onMouseMove(e) { onDragMove(e.clientX, e.clientY); }
1890
+ function onMouseUp() {
1891
+ onDragEnd();
1892
+ document.removeEventListener('mousemove', onMouseMove);
1893
+ document.removeEventListener('mouseup', onMouseUp);
1894
+ }
1895
+
1896
+ header.addEventListener('touchstart', function(e) {
1897
+ if (e.target.closest('button') || e.target.closest('a')) return;
1898
+ e.preventDefault();
1899
+ var t = e.touches[0];
1900
+ onDragStart(t.clientX, t.clientY);
1901
+ document.addEventListener('touchmove', onTouchMove, { passive: false });
1902
+ document.addEventListener('touchend', onTouchEnd);
1903
+ }, { passive: false });
1904
+ function onTouchMove(e) { e.preventDefault(); var t = e.touches[0]; onDragMove(t.clientX, t.clientY); }
1905
+ function onTouchEnd() {
1906
+ onDragEnd();
1907
+ document.removeEventListener('touchmove', onTouchMove);
1908
+ document.removeEventListener('touchend', onTouchEnd);
1909
+ }
1910
+ }
1911
+
1912
+ function makeResizable(el) {
1913
+ var handle = el.querySelector('.link-ctx-popup-resize');
1914
+ if (!handle) return;
1915
+ var startX, startY, startW, startH;
1916
+
1917
+ function onResizeStart(clientX, clientY) {
1918
+ startX = clientX; startY = clientY;
1919
+ startW = el.offsetWidth; startH = el.offsetHeight;
1920
+ el.style.width = startW + 'px';
1921
+ el.style.height = startH + 'px';
1922
+ el.style.maxHeight = 'none';
1923
+ }
1924
+ function onResizeMove(clientX, clientY) {
1925
+ el.style.width = Math.max(280, startW + clientX - startX) + 'px';
1926
+ el.style.height = Math.max(80, startH + clientY - startY) + 'px';
1927
+ }
1928
+
1929
+ handle.addEventListener('mousedown', function(e) {
1930
+ e.preventDefault(); e.stopPropagation();
1931
+ onResizeStart(e.clientX, e.clientY);
1932
+ document.addEventListener('mousemove', onMouseMove);
1933
+ document.addEventListener('mouseup', onMouseUp);
1934
+ });
1935
+ function onMouseMove(e) { onResizeMove(e.clientX, e.clientY); }
1936
+ function onMouseUp() {
1937
+ document.removeEventListener('mousemove', onMouseMove);
1938
+ document.removeEventListener('mouseup', onMouseUp);
1939
+ }
1940
+
1941
+ handle.addEventListener('touchstart', function(e) {
1942
+ e.preventDefault(); e.stopPropagation();
1943
+ var t = e.touches[0];
1944
+ onResizeStart(t.clientX, t.clientY);
1945
+ document.addEventListener('touchmove', onTouchMove, { passive: false });
1946
+ document.addEventListener('touchend', onTouchEnd);
1947
+ }, { passive: false });
1948
+ function onTouchMove(e) { e.preventDefault(); onResizeMove(e.touches[0].clientX, e.touches[0].clientY); }
1949
+ function onTouchEnd() {
1950
+ document.removeEventListener('touchmove', onTouchMove);
1951
+ document.removeEventListener('touchend', onTouchEnd);
1875
1952
  }
1876
1953
  }
1877
1954
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markdownr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.16
4
+ version: 0.5.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Dunn