Skip to content

Commit c0d20ae

Browse files
garvinhickinglinawolf
authored andcommitted
[TASK] Recreate integration baseline
1 parent 34b628c commit c0d20ae

File tree

47 files changed

+290
-48
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+290
-48
lines changed

packages/typo3-docs-theme/assets/js/link-reference-modal.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const SELECTOR_MODAL = '#linkReferenceModal';
44
const SELECTOR_ALERT_RST_NO_ANCHOR = '.alert-permalink-rst';
55
const SELECTOR_PERMALINK_URI = '#permalink-uri';
6+
const SELECTOR_SHORTLINK_URI = '#shortlink-uri';
67
const SELECTOR_PERMALINK_RST = '#permalink-rst';
78
const SELECTOR_PERMALINK_HTML = '#permalink-html';
89
const SELECTOR_ALERT_SUCCESS = '#permalink-alert-success';
@@ -16,6 +17,19 @@
1617
return rstAnchor ? `${window.location.origin}${window.location.pathname}#${rstAnchor}` : `${window.location.origin}${window.location.pathname}#${section?.id || ''}`;
1718
}
1819

20+
function generateShortUri(linkReferenceModal, section, headerText, rstAnchor, filename) {
21+
const urlPrefix = 'https://docs.typo3.org/permalink/';
22+
const interlinkTarget = linkReferenceModal.dataset.interlinkShortcode || 'somemanual';
23+
if (rstAnchor) {
24+
return urlPrefix + `${interlinkTarget}:${rstAnchor}`;
25+
}
26+
if (filename === '') {
27+
return '';
28+
}
29+
// @todo - check how anchor hashes + filenames work with redirects?
30+
return urlPrefix + `${interlinkTarget}:${filename}#${section?.id || ''}`;
31+
}
32+
1933
function generateRstLink(linkReferenceModal, section, headerText, rstAnchor, filename) {
2034
const interlinkTarget = linkReferenceModal.dataset.interlinkShortcode || 'somemanual';
2135
if (rstAnchor) {
@@ -36,16 +50,18 @@
3650
}
3751
}
3852

39-
function updateInputsAndTextareas(linkReferenceModal, header, headerText, uri, rstLink) {
53+
function updateInputsAndTextareas(linkReferenceModal, header, headerText, uri, rstLink, shortUri) {
4054
if (header) {
4155
linkReferenceModal.querySelector('h5').innerHTML = header;
4256
}
4357
if (uri === null) {
4458
// this can happen when opening a local file
4559
linkReferenceModal.querySelector(SELECTOR_PERMALINK_URI).value = '';
4660
linkReferenceModal.querySelector(SELECTOR_PERMALINK_HTML).value = '';
61+
linkReferenceModal.querySelector(SELECTOR_SHORTLINK_URI).value = '';
4762
} else {
4863
linkReferenceModal.querySelector(SELECTOR_PERMALINK_URI).value = uri;
64+
linkReferenceModal.querySelector(SELECTOR_SHORTLINK_URI).value = shortUri;
4965
linkReferenceModal.querySelector(SELECTOR_PERMALINK_HTML).value = `<a href="${uri}">${headerText}</a>`;
5066
}
5167
const rstInput = linkReferenceModal.querySelector(SELECTOR_PERMALINK_RST);
@@ -103,8 +119,9 @@
103119
const uri = generateUri(section, rstAnchor);
104120
const filename = linkReferenceModal.dataset.currentFilename;
105121
const rstLink = rstLinkData?rstLinkData:generateRstLink(linkReferenceModal, section, headerText, rstAnchor, filename);
122+
const shortUri = generateShortUri(linkReferenceModal, section, headerText, rstAnchor, filename);
106123

107-
updateInputsAndTextareas(linkReferenceModal, header, headerText, uri, rstLink);
124+
updateInputsAndTextareas(linkReferenceModal, header, headerText, uri, rstLink, shortUri);
108125

109126

110127
handleCopyButtons(linkReferenceModal);

packages/typo3-docs-theme/resources/public/js/theme.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/typo3-docs-theme/resources/template/structure/layoutParts/linkReferenceModal.html.twig

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@
1717
<input class="form-control code" id="permalink-uri" readonly>
1818
<button type="button" class="btn btn-outline-secondary copy-button" data-target="permalink-uri"><i class="far fa-clone"></i></button>
1919
</div>
20-
<p>Copy and freely share the link</p>
20+
<label for="shortlink-uri" class="col-form-label">Shortlink</label>
21+
<div class="input-group">
22+
<input class="form-control code" id="shortlink-uri" readonly>
23+
<button type="button" class="btn btn-outline-secondary copy-button" data-target="shortlink-uri"><i class="far fa-clone"></i></button>
24+
</div>
25+
<p><em>Copy and freely share the link</em></p>
2126
</div>
2227
<div class="mb-3">
2328
<div class="alert alert-warning alert-permalink-rst" role="alert">

tests/Integration/tests-full/breadcrumb/expected/index.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,12 @@ <h5 class="modal-title" id="linkReferenceModalLabel">Reference to the headline</
165165
<input class="form-control code" id="permalink-uri" readonly>
166166
<button type="button" class="btn btn-outline-secondary copy-button" data-target="permalink-uri"><i class="far fa-clone"></i></button>
167167
</div>
168-
<p>Copy and freely share the link</p>
168+
<label for="shortlink-uri" class="col-form-label">Shortlink</label>
169+
<div class="input-group">
170+
<input class="form-control code" id="shortlink-uri" readonly>
171+
<button type="button" class="btn btn-outline-secondary copy-button" data-target="shortlink-uri"><i class="far fa-clone"></i></button>
172+
</div>
173+
<p><em>Copy and freely share the link</em></p>
169174
</div>
170175
<div class="mb-3">
171176
<div class="alert alert-warning alert-permalink-rst" role="alert">This link target has no permanent anchor assigned.The link below can be used, but is prone to change if the page gets moved.

tests/Integration/tests-full/breadcrumb/expected/page.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,12 @@ <h5 class="modal-title" id="linkReferenceModalLabel">Reference to the headline</
171171
<input class="form-control code" id="permalink-uri" readonly>
172172
<button type="button" class="btn btn-outline-secondary copy-button" data-target="permalink-uri"><i class="far fa-clone"></i></button>
173173
</div>
174-
<p>Copy and freely share the link</p>
174+
<label for="shortlink-uri" class="col-form-label">Shortlink</label>
175+
<div class="input-group">
176+
<input class="form-control code" id="shortlink-uri" readonly>
177+
<button type="button" class="btn btn-outline-secondary copy-button" data-target="shortlink-uri"><i class="far fa-clone"></i></button>
178+
</div>
179+
<p><em>Copy and freely share the link</em></p>
175180
</div>
176181
<div class="mb-3">
177182
<div class="alert alert-warning alert-permalink-rst" role="alert">This link target has no permanent anchor assigned.The link below can be used, but is prone to change if the page gets moved.

tests/Integration/tests-full/breadcrumb/expected/yetAnotherPage.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,12 @@ <h5 class="modal-title" id="linkReferenceModalLabel">Reference to the headline</
164164
<input class="form-control code" id="permalink-uri" readonly>
165165
<button type="button" class="btn btn-outline-secondary copy-button" data-target="permalink-uri"><i class="far fa-clone"></i></button>
166166
</div>
167-
<p>Copy and freely share the link</p>
167+
<label for="shortlink-uri" class="col-form-label">Shortlink</label>
168+
<div class="input-group">
169+
<input class="form-control code" id="shortlink-uri" readonly>
170+
<button type="button" class="btn btn-outline-secondary copy-button" data-target="shortlink-uri"><i class="far fa-clone"></i></button>
171+
</div>
172+
<p><em>Copy and freely share the link</em></p>
168173
</div>
169174
<div class="mb-3">
170175
<div class="alert alert-warning alert-permalink-rst" role="alert">This link target has no permanent anchor assigned.The link below can be used, but is prone to change if the page gets moved.

0 commit comments

Comments
 (0)