Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
4ce317f5
Commit
4ce317f5
authored
Jan 16, 2024
by
Alejandro Celaya
Committed by
Alejandro Celaya
Jan 16, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use double-space for pretty-printed HTML indentation
parent
19aed53e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
12 deletions
+10
-12
ExportAnnotations-test.js
...bar/components/ShareDialog/test/ExportAnnotations-test.js
+2
-2
annotations-exporter.tsx
src/sidebar/services/annotations-exporter.tsx
+4
-1
annotations-exporter-test.js
src/sidebar/services/test/annotations-exporter-test.js
+3
-7
copy-to-clipboard.ts
src/sidebar/util/copy-to-clipboard.ts
+1
-2
No files found.
src/sidebar/components/ShareDialog/test/ExportAnnotations-test.js
View file @
4ce317f5
...
@@ -469,8 +469,8 @@ describe('ExportAnnotations', () => {
...
@@ -469,8 +469,8 @@ describe('ExportAnnotations', () => {
context
(
'when copying annotations export to clipboard'
,
()
=>
{
context
(
'when copying annotations export to clipboard'
,
()
=>
{
[
true
,
false
].
forEach
(
exportFormatsEnabled
=>
{
[
true
,
false
].
forEach
(
exportFormatsEnabled
=>
{
it
(
'displays copy button if `export_formats` FF is enabled'
,
()
=>
{
it
(
'displays copy button if `export_formats` FF is enabled'
,
()
=>
{
fakeStore
.
isFeatureEnabled
.
callsFake
(
fakeStore
.
isFeatureEnabled
.
callsFake
(
ff
=>
ff
=
>
exportFormatsEnabled
||
ff
!==
'export_formats'
,
ff
=
==
'export_formats'
?
exportFormatsEnabled
:
true
,
);
);
const
wrapper
=
createComponent
();
const
wrapper
=
createComponent
();
...
...
src/sidebar/services/annotations-exporter.tsx
View file @
4ce317f5
...
@@ -275,7 +275,10 @@ export class AnnotationsExporter {
...
@@ -275,7 +275,10 @@ export class AnnotationsExporter {
</
html
>,
</
html
>,
{},
{},
{
pretty
:
true
},
{
pretty
:
true
},
);
// `renderToString` indents lines with tabs when using `pretty: true`.
// Replacing them with double spaces we avoid side effects when pasting
// the result in a web app.
).
replace
(
/
\t
/g
,
' '
);
}
}
private
_exportCommon
(
private
_exportCommon
(
...
...
src/sidebar/services/test/annotations-exporter-test.js
View file @
4ce317f5
...
@@ -292,13 +292,9 @@ ${formattedNow},John Doe,,http://example.com,My group,Annotation,,Annotation tex
...
@@ -292,13 +292,9 @@ ${formattedNow},John Doe,,http://example.com,My group,Annotation,,Annotation tex
now
,
now
,
});
});
// The result uses tabs to indent lines.
// We can get rid of that for simplicity and just compare the markup
const
removeAllIndentation
=
str
=>
str
.
replace
(
/^
[
\t]
+/gm
,
''
);
assert
.
equal
(
assert
.
equal
(
re
moveAllIndentation
(
result
)
,
re
sult
,
removeAllIndentation
(
`<html lang="en">
`<html lang="en">
<head>
<head>
<title>
<title>
Annotations on "A special document"
Annotations on "A special document"
...
@@ -444,7 +440,7 @@ ${formattedNow},John Doe,,http://example.com,My group,Annotation,,Annotation tex
...
@@ -444,7 +440,7 @@ ${formattedNow},John Doe,,http://example.com,My group,Annotation,,Annotation tex
</article>
</article>
</section>
</section>
</body>
</body>
</html>`
)
,
</html>`
,
);
);
});
});
});
});
...
...
src/sidebar/util/copy-to-clipboard.ts
View file @
4ce317f5
...
@@ -45,8 +45,7 @@ export async function copyPlainText(text: string, navigator_ = navigator) {
...
@@ -45,8 +45,7 @@ export async function copyPlainText(text: string, navigator_ = navigator) {
}
}
/**
/**
* Copy the string `text` to the clipboard, rendering HTML if any, instead of
* Copy the string `text` to the clipboard with an HTML media type.
* raw markup.
*
*
* If the browser does not support this, it will fall back to copy the string
* If the browser does not support this, it will fall back to copy the string
* as plain text.
* as plain text.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment