blob: 23832072ab6c8fb351c3ee073a1c1c177882c0e6 [file] [log] [blame]
import {getOutlineNode} from './docHelper';
export const store = {
docType: '',
// Current selected option
currentPath: '',
// Search content
fuzzySearch: false,
searchQuery: '',
isMobile: false,
locale: 'zh'
};
export function getPagePath() {
if (store.isMobile) {
// No hierarchy
let parts = store.currentPath.split('.');
let node = getOutlineNode(store.currentPath);
let isLeaf = node && (!node.children || !node.children.length);
if (isLeaf && parts.length > 1) { // Is leaf
parts.pop();
}
return parts.join('.');
}
else {
return store.currentPath.split('.')[0];
}
}
export function isOptionDoc() {
return store.docType === 'option'
|| store.docType === 'option-gl';
}