mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-18 20:49:36 +01:00
mobile: implement toc
This commit is contained in:
committed by
Abdullah Atta
parent
c33c365b62
commit
71d94853ba
@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Editor } from "@notesnook/editor";
|
||||
import { Editor, scrollIntoViewById } from "@notesnook/editor";
|
||||
import {
|
||||
ThemeDefinition,
|
||||
useThemeColors,
|
||||
@@ -107,9 +107,17 @@ export type EditorController = {
|
||||
updateTab: () => void;
|
||||
loading: boolean;
|
||||
setLoading: (value: boolean) => void;
|
||||
getTableOfContents: () => any[];
|
||||
scrollIntoView: (id: string) => void;
|
||||
};
|
||||
|
||||
export function useEditorController(update: () => void): EditorController {
|
||||
export function useEditorController({
|
||||
update,
|
||||
getTableOfContents
|
||||
}: {
|
||||
update: () => void;
|
||||
getTableOfContents: () => any[];
|
||||
}): EditorController {
|
||||
const tab = useTabContext();
|
||||
const [loading, setLoading] = useState(true);
|
||||
const setTheme = useThemeEngineStore((store) => store.setTheme);
|
||||
@@ -341,6 +349,8 @@ export function useEditorController(update: () => void): EditorController {
|
||||
};
|
||||
|
||||
return {
|
||||
getTableOfContents: getTableOfContents,
|
||||
scrollIntoView: (id: string) => scrollIntoViewById(id),
|
||||
contentChange,
|
||||
selectionChange,
|
||||
titleChange,
|
||||
|
||||
Reference in New Issue
Block a user