Skip to content

Commit

Permalink
#6551 Keyboard doesn't appear or useless title selection (iPad). (#6581)
Browse files Browse the repository at this point in the history
* #6551 Keyboard doesn't appear or useless title selection (iPad).
Fixes #6551

* #6551 - get OS only in constructor
  • Loading branch information
novikov82 authored Feb 12, 2025
1 parent 5467d7b commit d1c1236
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/survey-creator-core/src/creator-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { IsTouch } from "survey-core";
import { QuestionConverter } from "./questionconverter";
import { SurveyTextWorker } from "./textWorker";
import { QuestionToolbox, QuestionToolboxItem } from "./toolbox";
import { assign } from "./utils/utils";
import { assign, getOS } from "./utils/utils";
import { getNextItemValue, getNextItemText } from "./utils/creator-utils";
import { PropertyGridModel } from "./property-grid";
import { ObjType, SurveyHelper } from "./survey-helper";
Expand Down Expand Up @@ -356,7 +356,10 @@ export class SurveyCreatorModel extends Base
this.startEditTitleOnQuestionAddedValue = value;
}
public get startEditTitleOnQuestionAdded() {
return !this.isMobileView && !this.toolbox.searchManager.filterString && this.startEditTitleOnQuestionAddedValue;
return !this.isMobileView &&
!((this.currentOS == "iOS" || this.currentOS == "Mac OS") && this.isTouch) &&
!this.toolbox.searchManager.filterString &&
this.startEditTitleOnQuestionAddedValue;
}
private startEditTitleOnQuestionAddedValue: boolean = true;
private isRTLValue: boolean = false;
Expand Down Expand Up @@ -1522,6 +1525,7 @@ export class SurveyCreatorModel extends Base
this.initTabs();
this.syncSaveButtons = this.options.saveSurveyAndTheme !== undefined ? this.options.saveSurveyAndTheme : this.options.syncSaveButtons;
this.isTouch = IsTouch;
this.currentOS = getOS();
const expandAction = this.sidebar.getExpandAction();
!!expandAction && this.toolbar.actions.push(expandAction);
}
Expand Down Expand Up @@ -4172,6 +4176,7 @@ export class SurveyCreatorModel extends Base
}
}) isMobileView: boolean;
@property({ defaultValue: false }) isTouch;
currentOS: string;
/**
* Specifies the Toolbox location.
*
Expand Down
23 changes: 23 additions & 0 deletions packages/survey-creator-core/src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,27 @@ export function sortDefaultThemes(defaultThemesOrder: Array<string>, themes: Arr
resultArray.push(themeName);
}
});
}

export function getOS(): "Mac OS" | "iOS" | "Windows" | "Android" | "Linux" {
const userAgent = window.navigator.userAgent,
platform = (window.navigator as any)?.userAgentData?.platform || window.navigator.platform,
macosPlatforms = ["macOS", "Macintosh", "MacIntel", "MacPPC", "Mac68K"],
windowsPlatforms = ["Win32", "Win64", "Windows", "WinCE"],
iosPlatforms = ["iPhone", "iPad", "iPod"];
let os = null;

if (macosPlatforms.indexOf(platform) !== -1) {
os = "Mac OS";
} else if (iosPlatforms.indexOf(platform) !== -1) {
os = "iOS";
} else if (windowsPlatforms.indexOf(platform) !== -1) {
os = "Windows";
} else if (/Android/.test(userAgent)) {
os = "Android";
} else if (/Linux/.test(platform)) {
os = "Linux";
}

return os;
}

0 comments on commit d1c1236

Please sign in to comment.