Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: make contentToOption totally optional #13139

Merged
merged 4 commits into from
Aug 26, 2020
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/component/toolbox/feature/DataView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,13 @@ class DataView extends ToolboxFeature<ToolboxDataViewFeatureOption> {
addEventListener(closeButton, 'click', close);

addEventListener(refreshButton, 'click', function () {
if ((typeof contentToOption === 'undefined' && typeof optionToContent !== 'undefined') ||
(typeof contentToOption !== 'undefined' && typeof optionToContent === 'undefined')) {
easonyq marked this conversation as resolved.
Show resolved Hide resolved
console.warn('It seems you have just provided one of `contentToOption` and `optionToContent` functions but missed the other one. Data change is ignored.')
close();
easonyq marked this conversation as resolved.
Show resolved Hide resolved
return;
}

let newOption;
try {
if (typeof contentToOption === 'function') {
Expand Down