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', () => {
context
(
'when copying annotations export to clipboard'
,
()
=>
{
[
true
,
false
].
forEach
(
exportFormatsEnabled
=>
{
it
(
'displays copy button if `export_formats` FF is enabled'
,
()
=>
{
fakeStore
.
isFeatureEnabled
.
callsFake
(
ff
=
>
exportFormatsEnabled
||
ff
!==
'export_formats'
,
fakeStore
.
isFeatureEnabled
.
callsFake
(
ff
=>
ff
=
==
'export_formats'
?
exportFormatsEnabled
:
true
,
);
const
wrapper
=
createComponent
();
...
...
src/sidebar/services/annotations-exporter.tsx
View file @
4ce317f5
...
...
@@ -275,7 +275,10 @@ export class AnnotationsExporter {
</
html
>,
{},
{
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
(
...
...
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
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
(
re
moveAllIndentation
(
result
)
,
removeAllIndentation
(
`<html lang="en">
re
sult
,
`<html lang="en">
<head>
<title>
Annotations on "A special document"
...
...
@@ -444,7 +440,7 @@ ${formattedNow},John Doe,,http://example.com,My group,Annotation,,Annotation tex
</article>
</section>
</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) {
}
/**
* Copy the string `text` to the clipboard, rendering HTML if any, instead of
* raw markup.
* Copy the string `text` to the clipboard with an HTML media type.
*
* If the browser does not support this, it will fall back to copy the string
* 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