Skip to content

Commit

Permalink
INTLY-1247: Add clipboard copy (#487)
Browse files Browse the repository at this point in the history
* first pass at clipboardcopy

* add multiline variant and other details

* remove copyField and related files

* rev version and fix test

* fix failing tests after rm node-modules
  • Loading branch information
mfrances17 authored Jul 23, 2019
1 parent 96bd4d3 commit ddc3fc8
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 418 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "integreatly-web-app",
"version": "2.12.0",
"version": "2.12.1",
"private": true,
"proxy": "http://localhost:5001/",
"dependencies": {
Expand Down
9 changes: 7 additions & 2 deletions src/components/asciiDocTemplate/asciiDocTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import Asciidoctor from 'asciidoctor.js';
import { translate } from 'react-i18next';
import CopyField from '../copyField/copyField';
import { ClipboardCopy, ClipboardCopyVariant } from '@patternfly/react-core';

class AsciiDocTemplate extends React.Component {
state = { loaded: false, docContent: null };
Expand Down Expand Up @@ -32,7 +32,12 @@ class AsciiDocTemplate extends React.Component {
if (this.rootDiv.current) {
const codeBlocks = this.rootDiv.current.querySelectorAll('pre');
codeBlocks.forEach(block => {
ReactDOM.render(<CopyField value={block.innerText} multiline={block.clientHeight > 40} />, block.parentNode);
ReactDOM.render(
<ClipboardCopy isReadOnly variant={block.clientHeight > 40 ? ClipboardCopyVariant.expansion : null}>
{block.innerText}
</ClipboardCopy>,
block.parentNode
);
});
}
}
Expand Down

This file was deleted.

41 changes: 0 additions & 41 deletions src/components/copyField/__tests__/copyField.test.js

This file was deleted.

228 changes: 0 additions & 228 deletions src/components/copyField/copyField.js

This file was deleted.

Loading

0 comments on commit ddc3fc8

Please sign in to comment.