Fix MAGN-3244, MAGN-3580 and MAGN-3599

It is verified there are no regressions for test cases related to CodeBlockNode.