1448, remove share#copyToClipboard changes
This commit is contained in:
parent
198b84efe1
commit
dee298fe33
|
@ -13,9 +13,4 @@ module SocialHelper
|
||||||
protocol: (APP_CONFIG["https"] ? :https : :http),
|
protocol: (APP_CONFIG["https"] ? :https : :http),
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def answer_copy_content(answer)
|
|
||||||
# copy content template: "question - answer [link]"
|
|
||||||
"#{answer.question.content} - #{answer.content} [#{answer_share_url(answer)}]"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,14 +5,12 @@ export default class extends Controller {
|
||||||
static values = {
|
static values = {
|
||||||
url: String,
|
url: String,
|
||||||
text: String,
|
text: String,
|
||||||
title: String,
|
title: String
|
||||||
copyContent: String
|
|
||||||
};
|
};
|
||||||
|
|
||||||
declare readonly urlValue: string;
|
declare readonly urlValue: string;
|
||||||
declare readonly textValue: string;
|
declare readonly textValue: string;
|
||||||
declare readonly titleValue: string;
|
declare readonly titleValue: string;
|
||||||
declare readonly copyContentValue: string;
|
|
||||||
|
|
||||||
share() {
|
share() {
|
||||||
let shareConfiguration = {};
|
let shareConfiguration = {};
|
||||||
|
@ -44,8 +42,4 @@ export default class extends Controller {
|
||||||
})
|
})
|
||||||
.catch(noop);
|
.catch(noop);
|
||||||
}
|
}
|
||||||
|
|
||||||
async copyToClipboard(){
|
|
||||||
await navigator.clipboard.writeText(this.copyContentValue)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,14 +30,4 @@ describe SocialHelper, type: :helper do
|
||||||
URL
|
URL
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#answer_copy_content" do
|
|
||||||
subject { answer_copy_content(answer) }
|
|
||||||
|
|
||||||
it "returns a formatted content to copy" do
|
|
||||||
expected_content = "#{answer.question.content} - #{answer.content} [https://example.com/@#{answer.user.screen_name}/a/#{answer.id}]"
|
|
||||||
|
|
||||||
expect(subject).to eq(expected_content)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue