Merge pull request #1618 from ONLYOFFICE/feature/react-refactoring
Refactoring 'EditText'
This commit is contained in:
commit
8323ac2934
|
@ -25,26 +25,10 @@ const PageFonts = props => {
|
|||
const spriteThumbs = storeTextSettings.spriteThumbs;
|
||||
const arrayRecentFonts = storeTextSettings.arrayRecentFonts;
|
||||
|
||||
useEffect(() => {
|
||||
setRecent(getImageUri(arrayRecentFonts));
|
||||
|
||||
return () => {
|
||||
}
|
||||
}, []);
|
||||
|
||||
const addRecentStorage = () => {
|
||||
let arr = [];
|
||||
arrayRecentFonts.forEach(item => arr.push(item));
|
||||
setRecent(getImageUri(arrayRecentFonts));
|
||||
LocalStorage.setItem('dde-settings-recent-fonts', JSON.stringify(arr));
|
||||
}
|
||||
|
||||
const [stateRecent, setRecent] = useState([]);
|
||||
const [vlFonts, setVlFonts] = useState({
|
||||
vlData: {
|
||||
items: [],
|
||||
}
|
||||
});
|
||||
LocalStorage.setItem('dde-settings-recent-fonts', JSON.stringify(arrayRecentFonts));
|
||||
};
|
||||
|
||||
const getImageUri = fonts => {
|
||||
return fonts.map(font => {
|
||||
|
@ -55,6 +39,13 @@ const PageFonts = props => {
|
|||
});
|
||||
};
|
||||
|
||||
const [stateRecent, setRecent] = useState(() => getImageUri(arrayRecentFonts));
|
||||
const [vlFonts, setVlFonts] = useState({
|
||||
vlData: {
|
||||
items: [],
|
||||
}
|
||||
});
|
||||
|
||||
const renderExternal = (vl, vlData) => {
|
||||
setVlFonts((prevState) => {
|
||||
let fonts = [...prevState.vlData.items];
|
||||
|
|
|
@ -209,26 +209,10 @@ const PageFonts = props => {
|
|||
const spriteThumbs = storeTextSettings.spriteThumbs;
|
||||
const arrayRecentFonts = storeTextSettings.arrayRecentFonts;
|
||||
|
||||
useEffect(() => {
|
||||
setRecent(getImageUri(arrayRecentFonts));
|
||||
|
||||
return () => {
|
||||
}
|
||||
}, []);
|
||||
|
||||
const addRecentStorage = () => {
|
||||
let arr = [];
|
||||
arrayRecentFonts.forEach(item => arr.push(item));
|
||||
setRecent(getImageUri(arrayRecentFonts));
|
||||
LocalStorage.setItem('ppe-settings-recent-fonts', JSON.stringify(arr));
|
||||
}
|
||||
|
||||
const [stateRecent, setRecent] = useState([]);
|
||||
const [vlFonts, setVlFonts] = useState({
|
||||
vlData: {
|
||||
items: [],
|
||||
}
|
||||
});
|
||||
LocalStorage.setItem('ppe-settings-recent-fonts', JSON.stringify(arrayRecentFonts));
|
||||
};
|
||||
|
||||
const getImageUri = fonts => {
|
||||
return fonts.map(font => {
|
||||
|
@ -239,6 +223,13 @@ const PageFonts = props => {
|
|||
});
|
||||
};
|
||||
|
||||
const [stateRecent, setRecent] = useState(() => getImageUri(arrayRecentFonts));
|
||||
const [vlFonts, setVlFonts] = useState({
|
||||
vlData: {
|
||||
items: [],
|
||||
}
|
||||
});
|
||||
|
||||
const renderExternal = (vl, vlData) => {
|
||||
setVlFonts((prevState) => {
|
||||
let fonts = [...prevState.vlData.items];
|
||||
|
|
|
@ -156,26 +156,10 @@ const PageFontsCell = props => {
|
|||
const spriteCols = storeTextSettings.spriteCols;
|
||||
const spriteThumbs = storeTextSettings.spriteThumbs;
|
||||
|
||||
useEffect(() => {
|
||||
setRecent(getImageUri(arrayRecentFonts));
|
||||
|
||||
return () => {
|
||||
}
|
||||
}, []);
|
||||
|
||||
const addRecentStorage = () => {
|
||||
let arr = [];
|
||||
arrayRecentFonts.forEach(item => arr.push(item));
|
||||
setRecent(getImageUri(arrayRecentFonts));
|
||||
LocalStorage.setItem('sse-settings-recent-fonts', JSON.stringify(arr));
|
||||
}
|
||||
|
||||
const [stateRecent, setRecent] = useState([]);
|
||||
const [vlFonts, setVlFonts] = useState({
|
||||
vlData: {
|
||||
items: [],
|
||||
}
|
||||
});
|
||||
LocalStorage.setItem('sse-settings-recent-fonts', JSON.stringify(arrayRecentFonts));
|
||||
};
|
||||
|
||||
const getImageUri = fonts => {
|
||||
return fonts.map(font => {
|
||||
|
@ -184,7 +168,14 @@ const PageFontsCell = props => {
|
|||
|
||||
return thumbCanvas.toDataURL();
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
const [stateRecent, setRecent] = useState(() => getImageUri(arrayRecentFonts));
|
||||
const [vlFonts, setVlFonts] = useState({
|
||||
vlData: {
|
||||
items: [],
|
||||
}
|
||||
});
|
||||
|
||||
const renderExternal = (vl, vlData) => {
|
||||
setVlFonts((prevState) => {
|
||||
|
|
|
@ -109,26 +109,10 @@ const PageFonts = props => {
|
|||
const spriteThumbs = storeTextSettings.spriteThumbs;
|
||||
const arrayRecentFonts = storeTextSettings.arrayRecentFonts;
|
||||
|
||||
useEffect(() => {
|
||||
setRecent(getImageUri(arrayRecentFonts));
|
||||
|
||||
return () => {
|
||||
}
|
||||
}, []);
|
||||
|
||||
const addRecentStorage = () => {
|
||||
let arr = [];
|
||||
arrayRecentFonts.forEach(item => arr.push(item));
|
||||
setRecent(getImageUri(arrayRecentFonts));
|
||||
LocalStorage.setItem('sse-settings-recent-fonts', JSON.stringify(arr));
|
||||
}
|
||||
|
||||
const [stateRecent, setRecent] = useState([]);
|
||||
const [vlFonts, setVlFonts] = useState({
|
||||
vlData: {
|
||||
items: [],
|
||||
}
|
||||
});
|
||||
LocalStorage.setItem('sse-settings-recent-fonts', JSON.stringify(arrayRecentFonts));
|
||||
};
|
||||
|
||||
const getImageUri = fonts => {
|
||||
return fonts.map(font => {
|
||||
|
@ -139,6 +123,13 @@ const PageFonts = props => {
|
|||
});
|
||||
};
|
||||
|
||||
const [stateRecent, setRecent] = useState(() => getImageUri(arrayRecentFonts));
|
||||
const [vlFonts, setVlFonts] = useState({
|
||||
vlData: {
|
||||
items: [],
|
||||
}
|
||||
});
|
||||
|
||||
const renderExternal = (vl, vlData) => {
|
||||
setVlFonts((prevState) => {
|
||||
let fonts = [...prevState.vlData.items];
|
||||
|
|
Loading…
Reference in a new issue