Skip to content

Commit 219b46f

Browse files
author
Nikolay Brankov
authored
data-copy feature (#60)
* Swap the inner text of a data-copy element on click if the data-copy-text attribute is declared * - Added scrutinizer.yml * - One CPU * - fix scrutinizer * - Added code standards * repush * repush
1 parent 335d5db commit 219b46f

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

.scrutinizer.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
build:
2+
nodes:
3+
analysis:
4+
resources:
5+
cpus: 1
6+
tests:
7+
override:
8+
- php-scrutinizer-run --enable-security-analysis
9+
- js-scrutinizer-run
10+
- command: phpcs-run --standard=vendor/packaged/codestandards/ruleset.xml ./src
11+
use_website_config: false
12+
environment:
13+
php:
14+
version: 7.4
15+
node: "v12.13.0"
16+
filter:
17+
paths:
18+
- "src/"
19+
excluded_paths:
20+
- "tests/"
21+
dependency_paths:
22+
- "vendor/"

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"require-dev": {
2222
"cubex/framework": "~4.0",
2323
"ext-dom": "*",
24-
"ext-libxml": "*"
24+
"ext-libxml": "*",
25+
"packaged/codestandards": "^1.0.0"
2526
},
2627
"autoload": {
2728
"psr-4": {

src/Foundation/res/data-copy.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ export function init(rootElement = document)
1515
rootElement, 'click', '[data-copy]', (e) =>
1616
{
1717
clipboard.writeText(e.delegateTarget.getAttribute('data-copy'));
18+
if(e.delegateTarget.getAttribute('data-copy-text'))
19+
{
20+
e.delegateTarget.innerText = e.delegateTarget.getAttribute('data-copy-text');
21+
}
1822
}
1923
);
2024
}

0 commit comments

Comments
 (0)