From 06246f7aeeaf88f0a0c5fadf5f9f6b44ed90f383 Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Tue, 15 Nov 2022 21:47:39 +0200 Subject: [PATCH] fix counter --- .../multipleQuestionStyles.css | 1 + .../TextBlockLevel/BlockQuoteService/BlockQuote.js | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/wax-prosemirror-services/src/MultipleChoiceQuestionService/multipleQuestionStyles.css b/wax-prosemirror-services/src/MultipleChoiceQuestionService/multipleQuestionStyles.css index d885bbf3b..7982754a5 100644 --- a/wax-prosemirror-services/src/MultipleChoiceQuestionService/multipleQuestionStyles.css +++ b/wax-prosemirror-services/src/MultipleChoiceQuestionService/multipleQuestionStyles.css @@ -5,6 +5,7 @@ .true-false, .true-false-single-correct { border: 3px solid #f5f5f7; + counter-reset: question-item-multiple; margin: 38px; padding: 20px; padding-top: 0px; diff --git a/wax-prosemirror-services/src/TextBlockLevel/BlockQuoteService/BlockQuote.js b/wax-prosemirror-services/src/TextBlockLevel/BlockQuoteService/BlockQuote.js index a8cf32cc0..545229370 100644 --- a/wax-prosemirror-services/src/TextBlockLevel/BlockQuoteService/BlockQuote.js +++ b/wax-prosemirror-services/src/TextBlockLevel/BlockQuoteService/BlockQuote.js @@ -2,9 +2,10 @@ import React from 'react'; import { injectable } from 'inversify'; import { isEmpty } from 'lodash'; import { wrapIn } from 'prosemirror-commands'; -import { NodeSelection } from 'prosemirror-state'; +import { NodeSelection, TextSelection } from 'prosemirror-state'; import { LeftSideButton } from 'wax-prosemirror-components'; import { Tools } from 'wax-prosemirror-core'; +import { findWrapping } from 'prosemirror-transform'; @injectable() class BlockQuote extends Tools { @@ -14,7 +15,16 @@ class BlockQuote extends Tools { get run() { return (state, dispatch) => { - wrapIn(state.config.schema.nodes.blockquote)(state, dispatch); + const selectionFrom = new TextSelection(state.doc.resolve(0)); + const selectionTo = new TextSelection( + state.doc.resolve(state.doc.content.size), + ); + + const range = selectionFrom.$from.blockRange(selectionTo.$to); + const wrapping = + range && findWrapping(range, state.config.schema.nodes.blockquote, {}); + + dispatch(state.tr.wrap(range, wrapping).scrollIntoView()); }; } -- GitLab